Configuring payments in the Blip builder June 16, 2023 18:28 Updated Index: Payments in Builder Payments via web page (Credit/debit card and bank slip) Automatic payments (Card on file) This functionality is in beta. Would you like to get early access? Subscribe to test it before the official launch! Payments in Builder To use payments in builder, you need to use the code processing action to send payment codes. This action can be activated in the block entry or exit actions, according to your needs. As mentioned above, there are different types of payments. For each payment, you need to add the code processing action differently, as explained below. Payments via web page (Credit/debit card and bank slip) Firstly, you need to know that the payment method via web page integrates Stripe’s Session payment and, in the examples below, only some of the data that can be informed to generate this kind of payment will be informed. For more details, access Stripe’s documentation. You will find below a referential of the data to be informed in this code and an example of the resource to be sent: To: postmaster@stripe.msging.net Method: set URI: /payment/{{contact.identity}}/session Type: application/json Resource: {"paymentMethodTypes": [ "card", "boleto"], "lineItems": [{ "amount": 50000, "currency": "brl", "description": "Blip Course - Taught by Blip", "images": [ "https://www.blip.net/files/themes/blank_theme/assets/img/blip-og-image.png"], "name": "Blip Course - Payment Module", "quantity": 1},{ "amount": 20000, "currency": "brl", "description": "Blip Course - Taught by Blip", "images": [ "https://www.blip.net/files/themes/blank_theme/assets/img/blip-og-image.png"], "name": "Blip Course - Catalog Module", "quantity": 1}], "paymentIntentData": {"setupFutureUsage": "on_session"}, "successUrl": "https://www.blip.net", "cancelUrl": "https://www.blip.net"} Each field of the "Resource" item has an important task in the generation of this type of payment. See below what each field represents in this resource template. It is worth mentioning that, as said before, you can use more fields to customize your payments according to your needs. For more information,access Stripe’s documentation. Resource Fields Description paymentMethodTypes Type of payment lineItems Items that will be purchased, followed by their respective prices, images, name, and quantity. successUrl URL of the website to which the user will be redirected once the payment is made. cancelUrl URL of the website to which the user will be redirected if the payment is canceled. paymentIntendData.setupFutureUsage Piece of information necessary to save the data of the card used in the payment link for future use (Card on File Payment). In this case, the user will be informed on the checkout screen that, once the payment is made, he/she will allow the brand to store this payment’s data for future use. Attention: Stripe’s interface will not allow the user to save his/her card during the checkout. This should be done during the link’s generation, since the parameter used to generate it will determine if the card will be saved or not. For that reason, it is important that the process of giving the user the option to save or not save his/her card is performed in the bot, when the link is generated. The “setupFutureUsage” property allows two values: “on_session” and “off_session.” To better understand the difference between them, read Stripe’s documentation. See an example of the action configured for this type of payment: At the end of this process, if the contact makes a successful payment, his/her stripeCustomerId will be added to his/her additional information. Therefore, the stripeCustomerId value must be informed in future payments to keep each contact’s payment context unique and updated. See below an example of this information linked to the contact: Automatic payments (Card on file) To make this kind of payment, the contact must make a payment via web page and save his/her card for future purchases. One way to validate if a contact completed this step is checking if the “stripeCustomerId” can be found in his/her additional information. Similarly, it is worth mentioning that the automatic payment method (Card on File) integrates Stripe’s Payment Intent and, in the examples below, only some of the data that can be informed to generate this kind of payment will be informed. For more details, access Stripe’s documentation. You will find below a referential of the data to be informed in this code and an example of the resource to be sent: To: postmaster@stripe.msging.net Method: set URI: /payment/{{contact.identity}}/payment-intent Type: application/json Resource: { "customer": "{{contact.extras.stripeCustomerId}}", "paymentMethodTypes": ["card"], "amount":1000, "currency":"brl", "confirm":"true", "paymentMethod":"card_1JAJVLAPY5jzkF510JNLqwGL"} Each field of the "Resource" item has an important task in the generation of this type of payment. See below what each field represents in this resource template. It is worth mentioning that, as said before, you can use more fields to customize your payments according to your needs. For more information,access Stripe’s documentation. Resource Fields Description customer Customer ID paymentMethodTypes Type of payment amount Price to be paid currency Code for the three-letter currency confirm Automatically confirms the payment once it is made. paymentMethod (Optional) ID of the card used to make the payment. If none is informed, the payment will be made using the default card. (Search for and select registered cards using this endpoint.) https://docs.blip.ai/#payment-methods See an example of the action configured for this type of payment: For more information, access the discussion about this topic in our community or watch our channel’s videos. 😃 Related articles Custom Breaks PicPay Payments NPS - Satisfaction Survey Sending WhatsApp Active Messages on Blip Desk How to save a contact's WhatsApp number