Initialize a transaction

Initiate a payment request to accept payment

NOTE: This section describes how to initialize a transaction on the server-side ie within your own application server using secret keys. To initialize a transaction on the client side (ie using public API keys), check out the quickstart section.

This API endpoint initializes a new payment from your backend/server.

A currency, amount, and customer object (with at least the customer's email) must be supplied. The customer is added to your list of customers if they do not already exist.

You may also provide a tx_ref (transaction reference) for the payment transaction. This must be a unique alpha-numeric string that cannot be repeated again in your transaction list (for at least 2 years). If you do not know how to generate this, we've got you. Leave it blank and we will fill it in.

NOTE: Initializing a transaction only indicates you want a customer to make a payment. However, the customer may cancel without completing the payment or payment may simply fail. So always make sure you verify the transaction status before giving value.

curl https://api.switchappgo.com/v1/transactions/server-initialize \
    -H "authorization: 'bearer sk_test_nTgS42KNdKr6Ts798DT'" \
    -d amount='3000' \
    -d currency='USD' \
    -d customer='{"email":"customer@email.com"}'

Last updated