Skip to main content

Saving payment information

When it comes to handling payments, it can be convenient to save payment details for future transactions. This guide will cover how to save payment information for later use, including setting up future payments, saving payment details during payments, and deleting saved payment information.

Set up future payments

To save payment information for future payments, you can use the register transaction API call. This type of transaction just stores payment information without holding or transferring funds. You can use this option to set up future payments for your customers.

Steps to use:

  1. Create a register transaction, providing as many customer details as you can. Choose one of the integration methods described in the getting started guide on accepting payments for completing the transaction.
    curl --request POST -sL \
    --url "https://gateway.ixopay.com/api/v3/transaction/${API_KEY}/register" \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header "Authorization: Basic $(echo -n "$USERNAME:$PASSWORD" | base64)" \
    --data-raw '{
    "merchantTransactionId": "your-unique-identifier",
    "transactionToken": "$CC_TOKEN",
    "successUrl": "https://shop.example.org/checkout/success",
    "cancelUrl": "https://shop.example.org/checkout/cancelled",
    "errorUrl": "https://shop.example.org/checkout/error",
    "callbackUrl": "https://api.example.org/callback"
    }'
  2. Store the uuid of the response in your database.
  3. When it's time to charge the customer, use either debit, incremental authorization or payout transaction API calls. Provide the stored uuid in the referenceUuid field. Choose a transaction indicator based on whether the follow-up payment is customer initiated or merchant initiated.

Save payment details during payment

Another way to save payment information is to use debit or preauthorize while simultaneously saving payment information for future payments. Debit transactions immediately transfer funds while preauthorize transactions place a hold on funds. The debit or preauthorize transactions must be created with the flag withRegister set to true.

Steps to use:

  1. Create a debit or preauthorize transaction, providing as many customer details as you can. Make sure to set the withRegister flag to true. Choose one of the integration methods described in the getting started guide on accepting payments for completing the transaction.
    curl --request POST -sL \
    --url "https://gateway.ixopay.com/api/v3/transaction/${API_KEY}/debit" \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --header "Authorization: Basic $(echo -n "$USERNAME:$PASSWORD" | base64)" \
    --data-raw '{
    "merchantTransactionId": "your-unique-identifier",
    "transactionToken": "$CC_TOKEN",
    "description": "Purchase description shown on credit card statement.",
    "amount": "9.99",
    "currency": "EUR",
    "withRegister": true,
    "successUrl": "https://shop.example.org/checkout/success",
    "cancelUrl": "https://shop.example.org/checkout/cancelled",
    "errorUrl": "https://shop.example.org/checkout/error",
    "callbackUrl": "https://api.example.org/callback"
    }'
  2. Store the uuid of the response in your database.
  3. When it's time to charge the customer, use either debit, incremental authorization or payout transaction API calls. Provide the stored uuid in the referenceUuid field. Choose a transaction indicator based on whether the follow-up payment is customer initiated or merchant initiated.

Deleting saved payment information

Saved payment information can be deleted using a deregister transaction. This transaction removes the payment information from the system, ensuring that it can no longer be used for future transactions. Send the uuid of a previously saved transaction in the referenceUuid field.

curl --request POST -sL \
--url "https://gateway.ixopay.com/api/v3/transaction/${API_KEY}/deregister" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "Authorization: Basic $(echo -n "$USERNAME:$PASSWORD" | base64)" \
--data-raw '{
"merchantTransactionId": "your-unique-identifier",
"referenceUuid": "$STORED_TRANSACTION_ID"
}'