Broadleaf Microservices
  • v1.0.0-latest-prod

Creating a Multi-Use Token (i.e. a Source ID)

Option 1: Swapping a Single-Use Token for a Multi-Use Token

A single-use card token can be directly exchanged for a multi-use token (i.e. a Source ID) by calling CheckoutComSavedPaymentMethodService#exchangeSingleUseTokenIfApplicable(…​). The single-use token should be provided via the paymentMethodProperties map, using the CheckoutConstants.TOKEN key. From there, we’ll leverage Checkout.com APIs to produce a Source ID & return it in the response map using the CheckoutConstants.SOURCE_ID key.

Option 2: Creating a Multi-Use Token via Transaction Execution

When executing an Authorize or AuthorizeAndCapture transaction with a single-use card token, Checkout.com will automatically produce a multi-use token (i.e. a Source ID). After these transactions are successfully executed, the Source ID can be gathered from the PaymentResponse by calling paymentResponse.getPaymentMethodProperties().get(CheckoutConstants.SOURCE_ID);.