How to make your first API payment

How to make your first API payment

So you’re ready to try and make your first test payment after signing up for Paychoice and receiving your sandbox API credentials for testing.

Step 1

Download curl for your operating system from http://curl.haxx.se/download.html

Step 2

To process a payment for $5.00 for your invoice 4325 which has been generated by your accounts department/system against John Smiths credit card use the following command:

curl https://sandbox.paychoice.com.au/api/v3/charge/
 -u "{username}:{password}"
 -d "currency=AUD"
 -d "amount=5.00"
 -d "reference=Invoice 4325"
 -d "card[name]=John Smith"
 -d "card[number]=4111-1111-1111-1111"
 -d "card[expiry_month]=12"
 -d "card[expiry_year]=16"
 -d "card[cvv]=123"

Don’t forget to use your sandbox API username and password!

Step 3

Check the response to see if the transaction has been approved by looking at the status_code. 0 means it was successful and the funds have been taken from the credit card which can also be seen from the status field. You can also verify the transaction by logging into your sandbox account.

{
  "charge": {
    "amount": "5",
    "created": "2012-12-06T06:27:34.0173352Z",
    "error": "Transaction Approved",
    "error_code": "0",
    "id": "f279074f-79af-47d1-961f-ea3f35e71ec0",
    "link": {
        "href": "/api/v3/charge/f279074f-79af-47d1-961f-ea3f35e71ec0",
        "rel": "self"
    },
    "reference": "Invoice 4325",
    "status": "Approved",
    "status_code": "0"
  },
  "object_type": "charge"
}
Step 4

Going live!

Swap over to your production account by updating the schema from the test environment with your production API username and password.

Step 5

Sit back and relax whilst we deposit the funds into your account.

Ready to go?

What are you waiting for? If you are in business and you’re not accepting online payments, then you’re losing money. Start accepting all major credit cards,
anytime, anywhere.

Sign Up Today
(*) Required Fields