Skip to main content

Goal

Enable a returning user to withdraw funds to the debit card they previously used to deposit via Apple Pay.
This flow builds on the Apple Pay Integration guide. Users must have completed an initial deposit through the Apple Pay flow before they can withdraw to their Apple Pay debit card. Complete that integration first.

Steps


Step 1: Display stored credentials and enable selection

What you need to do

Display the debit cards a user previously used with Apple Pay and allow them to select one to withdraw to.

How to do it

  1. Call the list-user-credentials endpoint with the user’s ID.
  2. Filter the returned credentials for those with type apple_pay_debit. Only these credentials can be used for withdrawals to a debit card stored via Apple Pay.
  3. Render the filtered credentials in your UI so they are easily identifiable, and allow the user to select which card they would like to withdraw to.
For apple_pay_debit credentials, the card_last4 field contains the last four digits of the user’s FPAN (the funding primary account number — i.e. the physical card number), not the last four of the device-specific card token (DPAN) generated by Apple. Display card_last4 so the user can recognize their physical card.

Step 2: Submit the withdrawal for authorization

What you need to do

Submit the withdrawal using the credential selected by the user.

How to do it

  1. Call the authorize-payment endpoint with the selected credential_id, direction set to cash_out, and the amount.
  2. On a 200 response, the withdrawal was approved. Display the result to the user.
  3. Handle the 401 response. In a small number of edge cases the user’s debit card does not support OCT (Original Credit Transactions), which are required to push funds to the card. When this occurs, prompt the user to withdraw to a different card.
A 401 indicates the selected card cannot receive funds via OCT. This is determined by the card issuer and is not something the user can resolve for that card — guide them to select or add another debit card to complete the withdrawal.
curl --request GET \
  --url https://sandbox.pushcash.com/user/{id}/credentials \
  --header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "id": "cred_7YlA9IiSl8UZvNwNSbFajV",
      "created_at": "2023-05-24T20:15:18.158Z",
      "card_last4": "4444",
      "authenticated": true,
      "type": "apple_pay_debit",
      "account_last4": null,
      "bank_name": null
    },
    {
      "id": "cred_8ZlB0JjTm9VZaOxOTcGbkW",
      "created_at": "2023-05-25T10:20:30.123Z",
      "card_last4": "1234",
      "authenticated": true,
      "type": "apple_pay",
      "account_last4": null,
      "bank_name": null
    }
  ]
}

Integration checklist

  • Create a stored apple_pay_debit-type credential by performing a deposit with a debit card from your Apple Pay wallet
    • Verify that the credential is displayed with card_last4
    • Test submitting a withdrawal transaction using the stored credential
  • Create a stored apple_pay-type credential by performing a deposit with a credit card from your Apple Pay wallet, verify the credential is not presented for withdrawals.
  • Test an OCT-decline by submitting a transaction with an apple_pay_debit-type credential for the amount of $22.00

Next steps

Enable withdrawals to be reviewed manually ahead of posting funds to the user’s account. Refer to the manual review guide for details.