After your buyer selects their method of payment in the previous step, you’re ready to create a transaction.

Create a Transaction

The transaction should be populated with the selected method, your redirect_url, and any other relevant transaction information.

  • payment_method.method - This will be the method selected by the customer at checkout. This will be one of the values retrieved from the payment options endpoint in the previous step.

  • payment_method.redirect_url - This should be provided to redirect the buyer back to your application after they have authenticated the payment. This is also required for card in order to support 3-D Secure.

See the POST /transactions API endpoint for more details.

The response of this transaction will include a status, which will tell you how to handle the next step.

Requests that require a redirect will return a status of buyer_approval_pending with a payment_method.approval_url. In the next step we will show you how to handle this situation.

{
    "type": "transaction",
    "id": "0c41c8df-27f4-480e-97f0-9401558ae25e",
    "merchant_account_id": "default",
    "created_at": "2023-04-28T08:33:06.979938+00:00",
    "updated_at": "2023-04-28T08:33:14.791510+00:00",
    "amount": 1299,
    "captured_amount": 0,
    "refunded_amount": 0,
    "currency": "AUD",
    "country": "AU",
    "external_identifier": null,
    "status": "buyer_approval_pending",
    "intent": "authorize",
    "payment_method": {
        "type": "payment-method",
        "method": "paypal",
        "mode": "redirect",
        "label": null,
        "scheme": null,
        "expiration_date": null,
        "approval_url": "https://www.sandbox.paypal.com/checkoutnow?token=7NP38594266148058",
        "country": "AU",
        "currency": "AUD",
        "details": null,
        "id": null,
        "approval_target": "any",
        "external_identifier": null
    },
    "method": "paypal",
    "error_code": null,
    "payment_service": {
        "id": "e9bd6ec4-03eb-410c-b655-45b458f185f2",
        "type": "payment-service",
        "payment_service_definition_id": "paypal-paypal",
        "method": "paypal",
        "display_name": "PayPal"
    },
    "buyer": null,
    "raw_response_code": "CREATED",
    "raw_response_description": "",
    "shipping_details": null,
    "avs_response_code": null,
    "cvv_response_code": null,
    "payment_source": "ecommerce",
    "merchant_initiated": false,
    "is_subsequent_payment": false,
    "cart_items": [],
    "statement_descriptor": null,
    "scheme_transaction_id": null,
    "three_d_secure": null,
    "payment_service_transaction_id": "7NP38594266148058",
    "metadata": null,
    "authorized_at": null,
    "captured_at": null,
    "voided_at": null,
    "buyer_approval_timedout_at": null
}

Summary

In this step you:

  • Called the transactions endpoint
  • Handled the transaction response