Broadleaf Microservices
  • v1.0.0-latest-prod

Using a Saved Payment Method

When creating or updating a payment, the savedPaymentMethodId property can be specified to populate the payment based on a saved payment method.

Note
For more details on adding and updating a payment, please refer to Adding a Payment and Updating a Payment for more details

Ownership Validation

When the savedPaymentMethodId is specified in the CreatePaymentRequest or UpdatePaymentRequest, an ownership validation is performed against the authenticated user and the specified saved payment method. This will ensure that the saved payment method cannot be used if it doesn’t belong to the currently authenticated user.

Important
Saved payment methods can only be used by registered users. If the user from current authentication context is not registered, then the request is rejected.

Building a Payment based on a saved payment method

The following Payment properties are populated when using a saved payment method:

  • savedPaymentMethodId - what saved payment method this Payment was created from

  • shouldSavePaymentForFutureUse - set to false

  • isSingleUsePaymentMethod - set to false

  • paymentMethodProperties

  • displayAttributes

  • billing address

Note
For details on these Payment properties or how a Payment can be saved, please refer to Saving a Payment Method for Future Use