Whatsapp Native Payment

Whatsapp Native Payment

References :

Payments API - SG - Cloud API - Documentation - Meta for Developers

How to Add Whatsapp Native Payment Integration

When selecting 'Add Integration' on the company's integration page, the following screen will appear. You can enter your preferred value in place of the integration name. For the payment configuration value, input the configuration obtained from your company's meta panel after integrating with Stripe.

How to Use Payment Module

After selecting the module shown in the above image on the Assistant Design page, the following screen will appear. On this screen, you can give any desired name to the module. Subsequently, you should choose 'WhatsApp Payment' from the payment type options. After selecting the payment type, you can choose the integration related to WhatsApp native payment from the dropdown menu below. Then, from top to bottom, you should sequentially select the currency for the payment and the duration until the payment expires.

If the payment is successful, the assistant will navigate to the "Payment Succeed" value selected in the module. If the payment fails, the assistant will navigate to the "Payment Failed" value selected in the module. If an unexpected error occurs, the assistant will navigate to the "fallback" value selected in the module.

Required Parameters

The following parameters need to be configured for the proper functioning of the WhatsApp Native Payment

WA_PAYMENT_TAX : This parameter represents the total tax amount for the payment, but currently, this parameter is not entirely accurate.

WA_PAYMENT_BENEFICIARIES_NAME : The name of the individual or business entity that will receive physical product deliveries.

WA_PAYMENT_BENEFICIARIES_ADDRESS_LINE : The delivery address of the recipient.

WA_PAYMENT_BENEFICIARIES_COUNTRY : The country where the recipient resides.

WA_PAYMENT_BENEFICIARIES_POSTAL_CODE : The postal code of the recipient.

COMMERCE_INTEGRATION_ID : The ID associated with the commerce integration used for the creation of the order and payment.

Technical Description

As shown in the upper part of the diagram, after the bot flow reaches the payment module, relevant parameters are set in the flow-backend. A request with these parameters is then sent to marketplace-integrations, where a message for the user to make the payment is generated. Subsequently, the message is returned to the flow-backend. The bot flow is then set to wait, and the payment message proceeds through chat-core and external before reaching the user.

As illustrated in the lower part of the diagram, after the user completes the payment, a webhook request from WhatsApp indicating the completion of the payment is received by the external. The external forwards this request to marketplace-integrations, where the webhook request is handled. If the payment is successful, a message is relayed to the flow-backend through the external, containing the "PAYMENT_CONFIRM=1" message within the conversation parameters, signaling the continuation of the bot flow. In case of payment failure, a similar message "PAYMENT_CONFIRM=0" is transmitted, and the bot flow proceeds accordingly based on the received message.