Requests that require a redirect will return a status of buyer_approval_pending with a payment_method.approval_url. In this situation, it’s required to redirect the buyer to this approval URL.

{
    "type": "transaction",
    "id": "0c41c8df-27f4-480e-97f0-9401558ae25e",
    "status": "buyer_approval_pending",
    "payment_method": {
        "type": "payment-method",
        "method": "paypal",
        "mode": "redirect",
        "approval_url": "https://www.sandbox.paypal.com/checkoutnow?token=7NP38594266148058",
        ...
    },
   ...
}

Approval may be needed for cards to facilitate 3-D Secure, and for non-cards to get the buyer to grant account payment authentication.

Start the approval

Your application will need to redirect your customer to the payment_method.approval_url, where they will be required to authenticate the payment. The exact way of this authentication will depend on the payment method.

After they’ve authenticated themselves, the customer will be redirected back to the redirect_url that you set when creating the transaction.

If the customer abandons the checkout or somehow experiences network connection issues, the transaction state can get out of sync between your application and ours. We recommend the following best practices in handling these situations.

Handle the return to your app

When a customer is redirected back to your site, the transaction status is not known. Your application will therefore need to call our API to get the latest transaction status. We will show you how to do this in the next step. To do this, your redirect_url will be appended with the gr4vy_transaction_id and status of the transaction.

[redirect_url]?gr4vy_transaction_id=2f37e0d0-5549-42c4-9c5c-e03d5fa97148&gr4vy_transaction_status=capture_succeeded

Although we do provide the gr4vy_transaction_status in this callback, it’s recommended to also fetch the latest status vai the API, as the status may have changed since.

After you’ve handled the redirect, you can display a message to your customer letting them know the result of the transaction.

Summary

In this step you:

  • Sent a customer to the approval URL
  • Handled the customer returning to your redirect URL