Manage payment configurations for WhatsApp Payments (India).
- GET /{WABA_ID}/payment_configurations
- GET /{WABA_ID}/payment_configuration/{CONFIGURATION_NAME}
- POST /{WABA_ID}/payment_configuration
- POST /{WABA_ID}/payment_configuration/{CONFIGURATION_NAME}
- POST /{WABA_ID}/generate_payment_configuration_oauth_link
- DELETE /{WABA_ID}/payment_configuration
provider_namevalues:upi_vpa,razorpay,payu,zaakpay.configuration_namemust be unique within a WABA.- OAuth link generation is required for gateway providers.
import WhatsApp from 'meta-cloud-api';
const client = new WhatsApp({
accessToken: process.env.CLOUD_API_ACCESS_TOKEN!,
phoneNumberId: Number(process.env.WA_PHONE_NUMBER_ID),
businessAcctId: process.env.WA_BUSINESS_ACCOUNT_ID!,
});
const configs = await client.payments.listPaymentConfigurations('WABA_ID');
await client.payments.createPaymentConfiguration('WABA_ID', {
configuration_name: 'test-config',
provider_name: 'razorpay',
redirect_url: 'https://example.com/redirect',
});
await client.payments.generatePaymentConfigurationOauthLink('WABA_ID', {
configuration_name: 'test-config',
redirect_url: 'https://example.com/redirect',
});
await client.payments.deletePaymentConfiguration('WABA_ID', {
configuration_name: 'test-config',
});listPaymentConfigurationspulls all configs for the WABA.createPaymentConfigurationneedsconfiguration_name,provider_name, andredirect_url.generatePaymentConfigurationOauthLinkissues an OAuth link for the configuration.deletePaymentConfigurationuses theconfiguration_nameto remove the config.