### Install swervpay-go with go get Source: https://docs.swervpay.co/sdks/go Run this command to install the Swervpay Go SDK from GitHub. ```bash $ go get github.com/swerv-ltd/swervpay-go ``` -------------------------------- ### Go SDK example to get banks Source: https://docs.swervpay.co/api-reference/others/get-banks Uses the swervpay-go package to create a client and call the Other.Banks() method. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: "", SecretKey: "", }) resp, err := client.Other.Banks() if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### Get All Wallets Response Example Source: https://docs.swervpay.co/wallet/introduction Example JSON response from the get all wallets endpoint. Shows the structure of a wallet object with fields for account details, balances, and timestamps. Balances are in the smallest currency unit. ```json [ { "account_name": "string", "account_number": "string", "account_type": "string", "balance": 100000, // Balance in the smallest currency unit "bank_address": "string", "bank_code": "string", "bank_name": "string", "created_at": "2024-01-01T00:00:00Z", "id": "wlt_123456789", "is_blocked": false, "pending_balance": 50000, // Pending balance in the smallest currency unit "reference": "string", "routing_number": "string", "total_received": 1500000, // Total amount received in the smallest currency unit "updated_at": "2024-01-02T00:00:00Z" } // ...other wallets ] ``` -------------------------------- ### Go SDK example to get all transactions Source: https://docs.swervpay.co/api-reference/transactions/get-all-transactions Use the swervpay-go client to fetch transactions. Configure with business ID and secret key, then call client.Transaction.Gets with a PageAndLimitQuery. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: "", SecretKey: "", }) query := swervpay.PageAndLimitQuery{ Limit: 10, Page: 1, } resp, err := client.Transaction.Gets(ctx, query) if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### Get All Customers - Request Examples Source: https://docs.swervpay.co/api-reference/customers/get-all-customers Example requests to retrieve all customers from the Swervpay API. The cURL command uses a bearer token, while the SDK examples use secret key and business ID for authentication. The Go example includes pagination parameters (limit and page). ```bash curl -X GET https://api.swervpay.co/api/v1/customers \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" ``` ```javascript import { SwervpayClient } from '@swervpaydev/sdk'; const config = { secretKey: "", businessId: "" } const swervpay = new SwervpayClient(config); await swervpay.customer.gets() ``` ```php use Swervpaydev\SDK\Swervpay; $config = [ 'business_id' => '', 'secret_key' => '' ]; $client = new Swervpay($config); $client->customer()->gets()->toArray(); ``` ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessId: businessId SecretKey: secretKey }) query := swervpay.PageAndLimitQuery{ Limit: 10, Page: 1, } resp, err := client.Customer.Gets(ctx, query) if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### Get All Collections Response Example Source: https://docs.swervpay.co/collection/introduction Response example for the get all collections endpoint. Shows the account object fields returned, including wallet-style fields like account number, bank details, currency, balance, and status. Note that balance, pending_balance, and total_received are in the smallest currency unit. ```json [ { "account_name": "string", "account_number": "string", "account_type": "string", "balance": 100000, // Balance in the smallest currency unit "bank_address": "string", "bank_code": "string", "bank_name": "string", "created_at": "2024-01-01T00:00:00Z", "id": "wlt_123456789", "is_blocked": false, "pending_balance": 50000, // Pending balance in the smallest currency unit "reference": "string", "routing_number": "string", "total_received": 1500000, // Total amount received in the smallest currency unit "updated_at": "2024-01-02T00:00:00Z" } // ...other collections ] ``` -------------------------------- ### PHP SDK example to get all transactions Source: https://docs.swervpay.co/api-reference/transactions/get-all-transactions Use the Swervpay class from Swervpaydev\SDK to fetch transactions. Configure with business ID and secret key, then call transaction()->gets()->toArray(). ```php use Swervpaydev\SDK\Swervpay; $config = [ 'business_id' => '', 'secret_key' => '' ]; $client = new Swervpay($config); $client->transaction()->gets()->toArray(); ``` -------------------------------- ### Installation Source: https://docs.swervpay.co/sdks/nodejs Install the Swervpay NodeJS SDK using your preferred package manager. ```APIDOC ## Installation Install the [swervpay-node](https://www.npmjs.com/package/@swervpaydev/sdk) SDK in your Node.js application using your preferred package manager. ```bash $ npm install @swervpaydev/sdk $ yarn add @swervpaydev/sdk $ pnpm add @swervpaydev/sdk $ bun install @swervpaydev/sdk ``` ``` -------------------------------- ### Go SDK example to get a transaction Source: https://docs.swervpay.co/api-reference/transactions/get Uses the Swervpay Go SDK to fetch a transaction. Requires a business ID and secret key in the client options. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: "", SecretKey: "", }) resp, err := client.Transaction.Get(ctx, "") if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### PHP SDK example to get banks Source: https://docs.swervpay.co/api-reference/others/get-banks Uses the Swervpay class from Swervpaydev\SDK to call the other()->banks() method. ```php use Swervpaydev\SDK\Swervpay; $config = [ 'business_id' => '', 'secret_key' => '' ]; $client = new Swervpay($config); $client->other()->banks()->toArray(); ``` -------------------------------- ### Install swervpay-php SDK with Composer Source: https://docs.swervpay.co/sdks/php Run this command in your terminal to install the swervpay-php SDK via Composer. Requires Composer to be installed. ```bash $ composer require swervpaydev/sdk ``` -------------------------------- ### Node.js SDK example to get banks Source: https://docs.swervpay.co/api-reference/others/get-banks Uses the SwervpayClient from @swervpaydev/sdk to call the other.banks() method. ```javascript import { SwervpayClient } from '@swervpaydev/sdk'; const config = { secretKey: "", businessId: "" } const swervpay = new SwervpayClient(config); await swervpay.other.banks() ``` -------------------------------- ### Node.js SDK example to get all transactions Source: https://docs.swervpay.co/api-reference/transactions/get-all-transactions Use the SwervpayClient from @swervpaydev/sdk to fetch transactions. Configure with your secret key and business ID, then call transaction.gets(). ```javascript import { SwervpayClient } from '@swervpaydev/sdk'; const config = { secretKey: "", businessId: "" } const swervpay = new SwervpayClient(config); await swervpay.transaction.gets() ``` -------------------------------- ### Get all customers Source: https://docs.swervpay.co/sdks/nodejs Retrieve all customers with pagination using the customer.gets method. The example parses limit and page from query parameters. ```javascript const customers = await swervpay.customer.gets({ limit: parseInt(req.query.limit as string), page: parseInt(req.query.page as string), }); ``` -------------------------------- ### Go SDK example to get a card transaction Source: https://docs.swervpay.co/api-reference/cards/get-transaction Use the swervpay-go client to retrieve a card transaction. Requires a business ID and secret key, and handles errors with log.Fatal. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: "", SecretKey: "", }) resp, err := client.Card.Transaction(ctx, "", "") if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### Install swervpay-laravel with Composer Source: https://docs.swervpay.co/sdks/laravel Installs the swervpay-laravel SDK via Composer. Run this in your Laravel project root before configuring the package. ```bash $ composer require swervpaydev/laravel ``` -------------------------------- ### Get All Transactions - Response Example Source: https://docs.swervpay.co/transaction/introduction Example response from the get all transactions endpoint. Returns an array of transaction objects with fields such as account_name, amount, status, and reference. ```json [ { "account_name": "Jane Doe", "account_number": "1234567890", "amount": 5000, "bank_code": "string", "bank_name": "Bank name", "category": "transfer", "charges": 50, "created_at": "2024-01-01T12:00:00Z", "detail": "Payment for services", "fiat_rate": 1.0, "id": "trans_789", "reference": "ref_101112", "report": false, "report_message": "", "session_id": "session_213", "status": "completed", "type": "debit", "updated_at": "2024-01-02T12:00:00Z" } ] ``` -------------------------------- ### Get a Transaction - Response Example Source: https://docs.swervpay.co/transaction/introduction Example JSON response from the get transaction endpoint. Returns a single transaction object, including a customer_id field not present in the list response. ```json { "account_name": "Jane Doe", "account_number": "1234567890", "amount": 5000, "bank_code": "string", "bank_name": "Bank name", "category": "transfer", "charges": 50, "created_at": "2024-01-01T12:00:00Z", "customer_id": "cust_456", "detail": "Payment for services", "fiat_rate": 1.0, "id": "trans_789", "reference": "ref_101112", "report": false, "report_message": "", "session_id": "session_213", "status": "completed", "type": "debit", "updated_at": "2024-01-02T12:00:00Z" } ``` -------------------------------- ### Go SDK example to blacklist a customer Source: https://docs.swervpay.co/api-reference/customers/blacklist Uses the swervpay-go package. Creates a client with BusinessID and SecretKey, then calls Customer.Blacklist with context and customer ID. Logs fatal error on failure. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: "", SecretKey: "", }) resp, err := client.Customer.Blacklist(ctx, "") if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### Use Swervpay client to list customers, banks, resolve accounts, and manage transactions Source: https://docs.swervpay.co/sdks/go Initializes the Swervpay client with your business ID and secret key from environment variables. Demonstrates listing customers, retrieving a customer by ID, creating a customer, listing banks, resolving an account number, and retrieving transactions. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "os" ) func main() { ctx := context.Background() businessId := os.Getenv("SWERVPAY_BUSINESS_ID") secretKey := os.Getenv("SWERVPAY_SECRET_KEY") client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: businessId, SecretKey: secretKey, }) customers, err := client.Customer.Gets(ctx, &swervpay.PageAndLimitQuery{ Page: 1, Limit: 10, }) if err != nil { panic(err) } for _, customer := range *customers { fmt.Printf("%v\n", customer) } customer, err := client.Customer.Get(ctx, "cus_123456") if err != nil { panic(err) } fmt.Printf("%v\n", customer) newCustomer, err := client.Customer.Create(ctx, &swervpay.CreateCustomerBody{ Firstname: "John", Lastname: "Doe", Middlename: "Doe", Email: "johndoe@gmail.com", Country: "Nigeria", }) if err != nil { panic(err) } fmt.Println("Created Customer id: " + newCustomer.ID) fmt.Printf("%v\n", newCustomer) banks, err := client.Other.Banks(ctx) if err != nil { panic(err) } for _, bank := range *banks { fmt.Printf("%v\n", bank) } resolveAccount, err := client.Other.ResolveAccountNumber(ctx, swervpay.ResolveAccountNumberBody{ BankCode: "044", AccountNumber: "0690000031", }) if err != nil { panic(err) } fmt.Printf("%v\n", resolveAccount) transactions, err := client.Transaction.Gets(ctx, &swervpay.PageAndLimitQuery{ Page: 1, Limit: 10, }) if err != nil { panic(err) } for _, transaction := range *transactions { fmt.Printf("%v\n", transaction) } transaction, err := client.Transaction.Get(ctx, "txn_123456") if err != nil { panic(err) } fmt.Printf("%v\n", transaction) } ``` -------------------------------- ### Get All Cards JSON Response Example Source: https://docs.swervpay.co/card/introduction Example JSON response from the get all cards endpoint, returning an array of card objects with details such as id, type, status, card number, balance, and timestamps. The response includes a comment indicating additional cards follow. ```json [ { "id": "card_123456789", "type": "virtual", "status": "active", "card_number": "4242424242424242", "expiry": "12/34", "cvv": "123", "name_on_card": "John Doe", "balance": 5000.25, "total_funded": 15000.75, "freeze": false, "address_street": "123 Swyft Street", "address_city": "Paytown", "address_state": "Paystate", "address_country": "NG", "address_postal_code": "123456", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-02T00:00:00Z", "masked_pan": "424242******4242" } // ...other cards ] ``` -------------------------------- ### Initialize Swervpay client and create customer Source: https://docs.swervpay.co/sdks/php Loads Composer's autoloader, initializes the Swervpay client with business ID and secret key from environment variables, and creates a customer. Keep credentials in environment variables or a server-side secret manager. ```php require __DIR__ . '/vendor/autoload.php'; use Swervpaydev\SDK\Swervpay; $client = new Swervpay([ 'business_id' => getenv('SWERVPAY_BUSINESS_ID'), 'secret_key' => getenv('SWERVPAY_SECRET_KEY'), ]); $customer = $client->customer()->create([ 'firstname' => 'Ada', 'lastname' => 'Okafor', 'email' => 'ada@example.com', 'country' => 'Nigeria', ]); ``` -------------------------------- ### List all collections with Go Source: https://docs.swervpay.co/api-reference/collections/get-all-collections Initialize the Swervpay client and use the Collection.Gets method with a PageAndLimitQuery to fetch collections. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessId: businessId SecretKey: secretKey }) query := swervpay.PageAndLimitQuery{ Limit: 10, Page: 1, } resp, err := client.Collection.Gets(ctx, query) if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### Create Card with Go SDK Source: https://docs.swervpay.co/api-reference/cards/create Use the swervpay-go SDK to create a card. Initialize the client with your business ID and secret key, build a CreateCardBody, and call Card.Create. The example logs a fatal error if creation fails. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: "", SecretKey: "", }) data := swervpay.CreateCardBody{ Type: "DEFAULT", Currency: "NGN", Issuer: "VERVE", CustomerId: "user", Amount: 1000 } resp, err := client.Card.Create(ctx, data) if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### Create a customer Source: https://docs.swervpay.co/sdks/nodejs Create a new customer using the customer.create method. The example includes firstname, lastname, email, middlename, and country fields. ```javascript const customer = await swervpay.customer.create({ firstname: req.body.first_name, lastname: req.body.last_name, email: req.body.email, middlename: "", country: req.body.country, }); ``` -------------------------------- ### Create customer with Go SDK Source: https://docs.swervpay.co/api-reference/customers/create Uses the swervpay-go package to create a customer. Requires a business ID and secret key in the client options, and handles errors with log.Fatal. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: "", SecretKey: "", }) data := swervpay.CreateCustomerBody{ Firstname: "Ada", Lastname: "Okafor", Middlename: "Ifeoma", Country: "NG", Email: "ada@example.com" } resp, err := client.Customer.Create(ctx, data) if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### Install Swervpay Node.js SDK with npm, yarn, pnpm, and bun Source: https://docs.swervpay.co/quickstart Install the @swervpaydev/sdk package using your preferred package manager. Choose one of the four commands based on your environment. ```bash $ npm install @swervpaydev/sdk ``` ```bash $ yarn add @swervpaydev/sdk ``` ```bash $ pnpm add @swervpaydev/sdk ``` ```bash $ bun install @swervpaydev/sdk ``` -------------------------------- ### Get all cards Source: https://docs.swervpay.co/sdks/nodejs Retrieve all cards with pagination using the card.gets method. The example parses limit and page from query parameters. ```javascript const cards = await swervpay.card.gets({ limit: parseInt(req.query.limit as string), page: parseInt(req.query.page as string), }); ``` -------------------------------- ### Get all transactions Source: https://docs.swervpay.co/sdks/nodejs Retrieve all transactions with pagination using the transaction.gets method. The example parses limit and page from query parameters. ```javascript const transactions = await swervpay.transaction.gets({ limit: parseInt(req.query.limit as string), page: parseInt(req.query.page as string), }); ``` -------------------------------- ### Client Initialization Source: https://docs.swervpay.co/sdks/nodejs Create the Swervpay client with your business ID and secret key. Load both values from your server's environment or secret manager. ```APIDOC ## Client Initialization Create the client with your business ID and secret key. Load both values from your server's environment or secret manager; do not commit them to source control or expose them in browser code. ```javascript import { SwervpayClient } from "@swervpaydev/sdk"; const swervpay = new SwervpayClient({ businessId: process.env.SWERVPAY_BUSINESS_ID!, secretKey: process.env.SWERVPAY_SECRET_KEY!, }); ``` ``` -------------------------------- ### PHP SDK example to get a transaction Source: https://docs.swervpay.co/api-reference/transactions/get Uses the Swervpay PHP SDK to fetch a transaction. Requires a business ID and secret key in the configuration. ```php use Swervpaydev\SDK\Swervpay; $config = [ 'business_id' => '', 'secret_key' => '' ]; $client = new Swervpay($config); $client->transaction()->get(''); ``` -------------------------------- ### Initialize SwervpayClient and create customer, card, collection, and payout Source: https://docs.swervpay.co/quickstart Initialize the SwervpayClient with server-side credentials (secret key and business ID from environment variables). Then create a customer, issue a card, create a USD collection account, and initiate a payout. The customer ID is reused for the card and collection operations. Persist the customer and collection IDs for later status checks and webhook reconciliation. ```javascript import { SwervpayClient } from "@swervpaydev/sdk"; const config = { secretKey: process.env.SWERVPAY_SECRET_KEY, businessId: process.env.SWERVPAY_BUSINESS_ID, }; const swervpay = new SwervpayClient(config); // Create a new customer const customer = await swervpay.customer.create({ firstname: "user", lastname: "user", middlename: "user", country: "user", email: "user@mailinator.com" }) // Create a new card await swervpay.card.create({ customer_id: customer.id, amount: 10, currency: "USD", issuer: "MASTERCARD", type: "DEFAULT" }) // Create a USD collection account for a customer const collection = await swervpay.collection.create({ customer_id: customer.id, currency: "USD", merchant_name: "Ada Okafor", amount: 0, type: "DEFAULT", additional_information: { account_type: "INDIVIDUAL", nin: "12345678901", tax_number: "12345678901", date_of_birth: "1994-04-12", employment_status: "EMPLOYED", account_designation: "PERSONAL", income_band: "UNDER_10000", source_of_income: "SALARY", address: { street: "12 Admiralty Way", city: "Lagos", state: "Lagos", country: "Nigeria", zip_code: "100001" }, document: { type: "NIN", number: "12345678901", issue_date: "2020-01-01", expiry_date: "2030-01-01", urls: ["https://example.com/document-front.jpg"] }, utility_bill: "https://example.com/utility-bill.pdf", bank_statement: "https://example.com/bank-statement.pdf" } }) // Create a new payout await swervpay.payout.create({ bank_code: "044", account_number: "0690000000", amount: 8500, currency: "NGN", reference: "payout_reference", narration: "Customer payout" }) ``` -------------------------------- ### Node.js SDK example to get a transaction Source: https://docs.swervpay.co/api-reference/transactions/get Uses the Swervpay SDK for Node.js to fetch a transaction. Requires a secret key and business ID in the configuration. ```javascript import { SwervpayClient } from '@swervpaydev/sdk'; const config = { secretKey: "", businessId: "" } const swervpay = new SwervpayClient(config); await swervpay.transaction.get('') ``` -------------------------------- ### Node.js SDK example to get a card transaction Source: https://docs.swervpay.co/api-reference/cards/get-transaction Use the SwervpayClient from @swervpaydev/sdk to retrieve a card transaction. Requires a secret key and business ID. ```javascript import { SwervpayClient } from '@swervpaydev/sdk'; const config = { secretKey: "", businessId: "" } const swervpay = new SwervpayClient(config); await swervpay.card.transaction('', ''); ``` -------------------------------- ### Go SDK example for client.Bill.List Source: https://docs.swervpay.co/api-reference/bills/lists Use the Swervpay Go SDK to list bill categories. Configure with your business ID and secret key, then call client.Bill.List with the category ID. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: "", SecretKey: "", }) resp, err := client.Bill.List(ctx, "") if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### List all collections with Node.js Source: https://docs.swervpay.co/api-reference/collections/get-all-collections Initialize the SwervpayClient with your secret key and business ID, then call the collection.gets() method. ```javascript import { SwervpayClient } from '@swervpaydev/sdk'; const config = { secretKey: "", businessId: "" } const swervpay = new SwervpayClient(config); await swervpay.collection.gets() ``` -------------------------------- ### PHP SDK example to get a card transaction Source: https://docs.swervpay.co/api-reference/cards/get-transaction Use the Swervpay class from Swervpaydev\SDK to retrieve a card transaction. Requires a business ID and secret key. ```php use Swervpaydev\SDK\Swervpay; $config = [ 'business_id' => '', 'secret_key' => '' ]; $client = new Swervpay($config); $client->card()->transaction('', ''); ``` -------------------------------- ### Initialize SwervpayClient with business ID and secret key Source: https://docs.swervpay.co/sdks/nodejs Create a SwervpayClient instance using environment variables for businessId and secretKey. Load these values from your server's environment or secret manager; do not commit them to source control or expose them in browser code. ```javascript import { SwervpayClient } from "@swervpaydev/sdk"; const swervpay = new SwervpayClient({ businessId: process.env.SWERVPAY_BUSINESS_ID!, secretKey: process.env.SWERVPAY_SECRET_KEY!, }); ``` -------------------------------- ### Create customer with PHP SDK Source: https://docs.swervpay.co/api-reference/customers/create Uses the Swervpay class from the Swervpaydev\SDK package to create a customer. Requires a business ID and secret key in the configuration array. ```php use Swervpaydev\SDK\Swervpay; $config = [ 'business_id' => '', 'secret_key' => '' ]; $client = new Swervpay($config); $client->customer()->create([ "firstname" => "Ada", "lastname" => "Okafor", "middlename" => "Ifeoma", "country" => "NG", "email" => "ada@example.com" ]); ``` -------------------------------- ### GET /cards Source: https://docs.swervpay.co/api-reference/cards/get-all-cards Documentation for the GET /cards endpoint that lists all cards. ```APIDOC ## GET /cards ### Description List all cards. ### Method GET ### Endpoint https://api.swervpay.co/api/v1/cards ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number for pagination. - **limit** (integer) - Optional - Number of cards per page. ### Request Example ```bash curl -X GET https://api.swervpay.co/api/v1/cards \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" ``` ### Response #### Success Response (200) Returns an array of card objects. Each card object has the following properties: - **address_city** (string) - City of the card's billing address. - **address_country** (string) - Country of the card's billing address. - **address_postal_code** (string) - Postal code of the card's billing address. - **address_state** (string) - State of the card's billing address. - **address_street** (string) - Street of the card's billing address. - **balance** (number) - Current balance on the card. - **card_number** (string) - The card number. - **created_at** (string, date-time) - Timestamp when the card was created. - **currency** (string) - Currency of the card. - **cvv** (string) - The card's CVV. - **encrypted_details** (string) - Encrypted card details. - **expiry** (string) - Card expiry date. - **freeze** (boolean) - Whether the card is frozen. - **id** (string) - Unique identifier of the card. - **is_physical** (boolean) - Whether the card is physical. - **issuer** (string) - Card issuer. - **masked_pan** (string) - Masked PAN. - **name_on_card** (string) - Name printed on the card. - **pending_balance** (number) - Pending balance on the card. - **re_issued** (boolean) - Whether the card has been re-issued. - **status** (string) - Status of the card. - **total_funded** (number) - Total amount funded to the card. - **type** (string) - Type of card. - **updated_at** (string, date-time) - Timestamp when the card was last updated. #### Response Example ```json [ { "address_city": "string", "address_country": "string", "address_postal_code": "string", "address_state": "string", "address_street": "string", "balance": 0, "card_number": "string", "created_at": "2023-01-01T00:00:00Z", "currency": "string", "cvv": "string", "encrypted_details": "string", "expiry": "string", "freeze": true, "id": "string", "is_physical": true, "issuer": "string", "masked_pan": "string", "name_on_card": "string", "pending_balance": 0, "re_issued": true, "status": "string", "total_funded": 0, "type": "string", "updated_at": "2023-01-01T00:00:00Z" } ] ``` ### Error Responses - **401 Unauthorized** - Invalid or missing authentication token. - **403 Forbidden** - Insufficient permissions. - **500 Internal Server Error** - Unexpected server error. ### Authentication Requires a Bearer token in the Authorization header. ``` -------------------------------- ### Go: Get All Cards using swervpay-go Source: https://docs.swervpay.co/api-reference/cards/get-all-cards Creates a Swervpay client and calls client.Card.Gets with pagination query. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessId: businessId SecretKey: secretKey }) query := swervpay.PageAndLimitQuery{ Limit: 10, Page: 1, } resp, err := client.Card.Gets(ctx, query) if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### cURL: Get All Cards Source: https://docs.swervpay.co/api-reference/cards/get-all-cards Sends a GET request to the /cards endpoint with bearer token authentication. ```bash curl -X GET https://api.swervpay.co/api/v1/cards \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" ``` -------------------------------- ### Get FX rate Source: https://docs.swervpay.co/sdks/nodejs Get the current exchange rate using the fx.rate method, providing from, to, and amount. ```javascript const result = await swervpay.fx.rate({ from: req.body.from as string, to: req.body.to as string, amount: req.body.amount as number, }); ``` -------------------------------- ### Go SDK: Get All Wallets Source: https://docs.swervpay.co/api-reference/wallets/get-all-wallets Uses the swervpay-go client to fetch wallets with pagination. Requires BusinessID and SecretKey in the client option. ```go package main import ( "context" "fmt" "github.com/swerv-ltd/swervpay-go" "log" ) func main() { ctx := context.Background() client := swervpay.NewSwervpayClient(&swervpay.SwervpayClientOption{ BusinessID: "", SecretKey: "", }) query := swervpay.PageAndLimitQuery{ Limit: 10, Page: 1, } resp, err := client.Wallet.Gets(ctx, query) if err != nil { log.Fatal("error", err.Error()) return } } ``` -------------------------------- ### cURL Request to Get All Wallets Source: https://docs.swervpay.co/api-reference/wallets/get-all-wallets Sends a GET request to the /wallets endpoint with bearer token authentication. ```bash curl -X GET https://api.swervpay.co/api/v1/wallets \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" ```