Skip to content

Existing payment methods

Imogen Hardy edited this page Nov 7, 2022 · 1 revision

What is it?

If a user already pays or has paid for a Guardian product via credit/debit card or direct debit, then they can be directed to the contribution/supporter plus checkout from within Manage My Account with an option enabled to pay by one of the existing payment methods we have on file for them. These appear in the payment method selector along with the regular card/direct debit/etc options.

How do we use it?

If a signed-in user lands on the checkout with a displayExistingPaymentMethods=true query parameter in the URL, we make a request to Members Data API for any existing payment methods associated with their account. This will return either:

  • An empty list- the user has no saved payment methods, so there's nothing to render.
  • A list of objects that only include a paymentType key, indicating that the payment methods may be out of date or otherwise unusable. We then offer the user the option to re-authenticate, along with the regular payment methods.
  • A list of objects that include a paymentType along with other information, crucially a billingAccountId which is what enables us to re-use this payment method. These are rendered as potential options in the payment method selector.

If the user selects to pay using an existing payment method, the associated payment method's billingAccountId is what's sent as payment information in the same way as we might use a Stripe payment_method or a PayPal baid.

Specific concerns

  • These payment methods can be controlled by switches for ExistingCard and ExistingDirectDebit. If both are turned off we don't make the request to MDAPI as there's no point; otherwise the switches control whether any existing payment methods will appear in the payment method selector in the same way as other methods.
  • This function is currently (Nov 2022) very difficult to test.

πŸ™‹β€β™€οΈ General Information

🎨 Client-side 101

βš›οΈ React+Redux

πŸ’° Payment methods

πŸŽ› Deployment & Testing

πŸ“Š AB Testing

🚧 Helper Components

πŸ“š Other Reference

1️⃣ Quickstarts

πŸ›€οΈ Tracking

Clone this wiki locally