Process a Purchase

POST /directdebit/v1/accounts/account_id/purchases

A Direct Debit purchase request allows you to transfer money from a customer's bank account to your merchant account. To process a purchase, you must make a POST request to the purchases endpoint for the relevant bank account type: ACH, EFT, SEPA or BACS; in the example below this is an ACH account. The transaction is completed in real time, though the banking network typically takes 3–5 days to transfer the funds.

For details of how to process a purchase invoking Split Payouts, click here.

Request Example
curl -X POST https://api.test.paysafe.com/directdebit/v1/accounts/89987201/purchases \
  -u devcentre322:B-qa2-0-53625f86-302c021476f52bdc9deab7aea876bb28762e62f92fc6712d0214736abf501e9675e55940e83ef77f5c304edc7968 \
  -H 'Content-Type: application/json' \
  -d ' {
        "merchantRefNum": "ORDER_ID:1231",
        "amount": 10098,
        "ach": {
                "accountHolderName": "XYZ Company",
                "accountType": "CHECKING",
                "accountNumber": "988772192",
                "routingNumber": "211589828",
                "payMethod": "WEB"
                },
        "customerIp": "192.0.126.111",
        "profile": {
                "firstName": "Joe",
                "lastName": "Smith",
                "email": "Joe.Smith@hotmail.com"
        },
        "billingDetails": {
                "street": "100 Queen Street West",
                "city": "Los Angeles",
                "state": "CA",
                "country": "US",
                "zip": "90210",
                "phone": "3102649010"
        }
        } '

This request contains a profile, billing address, and full bank account information. You can make this request without these details if you use a payment token created with the Paysafe Customer Vault API.

By default the Direct Debit processing system will check for duplicate transactions.

Prior to trying the example, you should:

  • Provide a unique merchant reference number for each transaction (if this value is not unique, and the number has been used in the past 90 days, the request will be flagged as a duplicate).
  • Replace the merchant account number (89987201 in the example above) in the URL with the test account number you received for the currency you wish to test.
  • Replace the API key (after the -u) with the API key you have received.
Response Example
{
    "links": [
        {
            "rel": "self",
            "href": "https://api.test.paysafe.com/directdebit/v1/accounts/89987201/purchases/a02e52c7-c991-4418-966a-b62989cb0eae"
        }
    ],
    "id": "a02e52c7-c991-4418-966a-b62989cb0eae",
    "merchantRefNum": "ORDER_ID:1231",
    "amount": 10098,
    "ach": {
        "accountHolderName": "XYZ Company",
        "accountType": "CHECKING",
        "lastDigits": "92",
        "routingNumber": "211589828",
        "payMethod": "WEB"
    },
    "customerIp": "192.0.126.111",
    "profile": {
        "firstName": "Joe",
        "lastName": "Smith",
        "email": "Joe.Smith@hotmail.com"
    },
    "billingDetails": {
        "street": "100 Queen Street West",
        "city": "Los Angeles",
        "state": "CA",
        "country": "US",
        "zip": "90210",
        "phone": "3102649010"
    },
    "txnTime": "2014-12-14T15:12:18Z",
    "currencyCode": "USD",
    "status": "PENDING"
}

The response returns an id value and a status that indicates whether the purchase is complete, pending, or failed. The purchase ID can be used to look up or cancel the purchase.

See our API Reference section for a full description of the parameters required for the request and returned in the response.

Did you find this page useful?