Skip to main content

PaymentMethods

Methods for handling Payment Methods.

listPaymentMethods v1.0.0 read payment methods Types

Get a paginated list of paymentMethods for the store.

import { listPaymentMethods } from '@rechargeapps/storefront-client';
await listPaymentMethods(session, {
limit: 25,
});

getPaymentMethod v1.0.0 read payment methods Types

Get a payment method by payment method ID.

import { getPaymentMethod } from '@rechargeapps/storefront-client';
await getPaymentMethod(session, 123);

createPaymentMethod v1.12.0 write payment methods Types

Create a payment method.

Currently, shopify_payments is in read-only mode and can only be managed by Shopify.

import { createPaymentMethod } from '@rechargeapps/storefront-client';
await createPaymentMethod(session, {
default: true,
payment_type: 'CREDIT_CARD',
processor_customer_token: 'cus_JGYtLWi2HS8ymD',
processor_name: 'stripe',
processor_payment_method_token: 'pm_34jdshjs',
});

updatePaymentMethod v1.0.0 write payment methods Types

Update a payment method by payment method ID.

Currently, shopify_payments is in read-only mode and can only be managed by Shopify.

If using shopify_payments you can notify a customer to update their payment method via sendCustomerNotification, which allows you to send a link to the customer so they can update a specific payment method.

import { updatePaymentMethod } from '@rechargeapps/storefront-client';
await updatePaymentMethod(session, 123, { default: true });

initFrictionlessPaymentV1 v1.80.0 write payment methods Types

Initialize the frictionless payment form. Second argument is the Recharge payment method ID (if updating an existing payment method).

For more details and an example, see the Frictionless Payments.

import { initFrictionlessPaymentV1 } from '@rechargeapps/storefront-client';
const formController = await initFrictionlessPaymentV1(session, 123);