A transaction can be created for non-card services by calling the POST /transactions API. The call requires an amount, currency, and a payment_method with a redirect_url, country and currency.

At the moment, our API allows you to create transactions for the services below:

  • Banked
  • GoCardless
  • PayPal

There is little need to use these APIs directly if you are using [Embed] instead. [Embed] automatically creates transactions against these APIs and can even bind them to a previously created buyer.

Transacting with a non-card account is a 2-step process that requires a buyer to be redirected to get explicit authorization.

Step 1. Initialize a new transaction

The first step is to initialize a new transaction. A redirect_url needs to be provided to redirect the user back to your application after they have approved the transaction in the external service. The country and currency are optional but sometimes are required depending on the service used.

The API returns a new transaction resource for which the status is set to buyer_approval_pending.

POST /transactions
{
  "type": "transaction",
  "id": "f2164272-9eee-48ec-86d6-74aa2437b25a",
  "created_at": "2021-11-04T09:27:15.642524+00:00",
  "updated_at": "2021-11-04T09:27:21.277277+00:00",
  "amount": 1299,
  "captured_amount": 0,
  "refunded_amount": 0,
  "currency": "AUD",
  "external_identifier": null,
  "status": "buyer_approval_pending",
  "payment_method": {
    "approval_url": "https://www.sandbox.paypal.com/checkoutnow?token=65G62408D47889217",
    "expiration_date": null,
    "external_identifier": null,
    "id": null,
    "label": null,
    "method": "paypal",
    "scheme": null,
    "type": "payment-method"
  },
  "payment_service": {
    "id": "e9bd6ec4-03eb-410c-b655-45b458f185f2",
    "type": "payment-service",
    "payment_service_definition_id": "paypal-paypal",
    "method": "paypal"
  },
  "buyer": null
}

Statuses

See our guide on transaction statuses for more details.

Step 2. Redirect the user

For the next step, you will need to redirect the buyer to the URL specified in the payment_method.approval_url field of the response.

The buyer then has to approve the transaction. After this, the buyer is redirected back to the redirect_url you specified earlier. For example:

https://example.com/complete?transaction_id=f2164272-9eee-48ec-86d6-74aa2437b25a&transaction_status=authorization_succeeded

The transaction_id query parameter represents the ID of the transaction and the transaction_status represents the new status of the transaction.

(Optional) Step 3. Confirm the transaction

Finally, you could make an optional API call to confirm the transaction has been successfully authorized or captured.

The API will return the same transaction resource with its updated status.

GET /transactions/f2164272-9eee-48ec-86d6-74aa2437b25a
{
  "type": "transaction",
  "id": "f2164272-9eee-48ec-86d6-74aa2437b25a",
  "created_at": "2021-11-04T09:27:15.642524+00:00",
  "updated_at": "2021-11-04T09:31:55.414336+00:00",
  "amount": 1299,
  "captured_amount": 0,
  "refunded_amount": 0,
  "currency": "AUD",
  "external_identifier": null,
  "status": "authorization_succeeded",
  "payment_method": {
    "approval_url": "https://www.sandbox.paypal.com/checkoutnow?token=65G62408D47889217",
    "expiration_date": null,
    "external_identifier": null,
    "id": null,
    "label": "sb-fauuj6390384@personal.example.com",
    "method": "paypal",
    "scheme": null,
    "type": "payment-method"
  },
  "payment_service": {
    "id": "e9bd6ec4-03eb-410c-b655-45b458f185f2",
    "type": "payment-service",
    "payment_service_definition_id": "paypal-paypal",
    "method": "paypal"
  },
  "buyer": null
}