You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two weeks ago, WhatsApp announced the Payments API support for Cloud API. However, there's one limitation in order to use it: both the bussiness and the client must reside in Signapore.
The main focus of this library is improving the API documentation and throwing errors before sending the requests, and in most cases that's achieved by manually testing the API before release. Unfortunately, this is not possible with the new features due to the regional limitation.
That's why we have concluded that payments (and address messages) will not be officially supported until a global release (or at least until we are able to test it). We want to deliver high quality code, and without testing it we can't assure it will reach our standars.
So... What should I do if I want to use them?
This decision doesn't mean you need to get a different library to get the job done. whatsapp-api-js was designed with great flexibility in mind to cover this exact type of scenarios, so it's still possible to send payments messages by manually creating the object. As a matter of facts, this new message type is an extension of Interactive, so the next block of code will work:
// The action object was copy pasted from the Payments API documentationconstpayment_message=newInteractive({// Interactive requires this string to be equal to the type of action, in this case "review_and_pay"get_type(){return"review_and_pay";},"name": "review_and_pay","parameters": {"reference_id": "reference-id-value","type": "digital-goods","payment_type": "p2m-lite:stripe","payment_configuration": "unique-payment-config-id","currency": "SGD","total_amount": {"value": 21000,"offset": 100},"order": {"status": "pending","catalog_id": "the-catalog_id","expiration": {"timestamp": "utc_timestamp_in_seconds","description": "expiration-explanation"},"items": [{"retailer_id": "1234567","name": "Product name, for example bread","amount": {"value": 10000,"offset": 100},"quantity": 5,"sale_amount": {"value": 10000,"offset": 100}}],"subtotal": {"value": 10000,"offset": 100},"shipping": {"value": 10000,"offset": 100,"description": "optional_text"},"discount": {"value": 10000,"offset": 100,"description": "optional_text","discount_program_name": "optional_text"},"tax": {"value": 10000,"offset": 100,"description": "optional_text"},}}},newBody("Hey, you should definitely buy this!"));Whatsapp.sendMessage(payment_message).then(console.log);
A similar code can be used to notify the order status (step 4 in the official documentation), and to send Address Messages (also an Interactive extension).
When will the library support it?
There's no ETA for the global release, hence no ETA for an update. There might be a branch with the bare bones of the code, but it won't be merged and published until tested.
I live in Signapore, can I help?
Sure! PR are welcome, so feel free to fork the repo and help the library get the missing features. Remember to follow the CONTRIBUTING.md rules, as this would count as a big update.
That's all to be said. We hope you can understand this decision wasn't taken lightly, and lets hope WhatsApp extends the feature to more countries soon!
(Will take this opportunity to say thanks to everyone who has submited an issue, PR, or starred the repo, I really appreciate it 😄)
The text was updated successfully, but these errors were encountered:
TL;DR
It won't be supported yet
The main issue
Two weeks ago, WhatsApp announced the Payments API support for Cloud API. However, there's one limitation in order to use it: both the bussiness and the client must reside in Signapore.
The main focus of this library is improving the API documentation and throwing errors before sending the requests, and in most cases that's achieved by manually testing the API before release. Unfortunately, this is not possible with the new features due to the regional limitation.
That's why we have concluded that payments (and address messages) will not be officially supported until a global release (or at least until we are able to test it). We want to deliver high quality code, and without testing it we can't assure it will reach our standars.
So... What should I do if I want to use them?
This decision doesn't mean you need to get a different library to get the job done. whatsapp-api-js was designed with great flexibility in mind to cover this exact type of scenarios, so it's still possible to send payments messages by manually creating the object. As a matter of facts, this new message type is an extension of Interactive, so the next block of code will work:
A similar code can be used to notify the order status (step 4 in the official documentation), and to send Address Messages (also an Interactive extension).
When will the library support it?
There's no ETA for the global release, hence no ETA for an update. There might be a branch with the bare bones of the code, but it won't be merged and published until tested.
I live in Signapore, can I help?
Sure! PR are welcome, so feel free to fork the repo and help the library get the missing features. Remember to follow the CONTRIBUTING.md rules, as this would count as a big update.
That's all to be said. We hope you can understand this decision wasn't taken lightly, and lets hope WhatsApp extends the feature to more countries soon!
(Will take this opportunity to say thanks to everyone who has submited an issue, PR, or starred the repo, I really appreciate it 😄)
The text was updated successfully, but these errors were encountered: