Broadleaf Microservices
  • v1.0.0-latest-prod

Preparing a PaymentTransactionServices Payment for Tabby Transactions

To execute Tabby transactions via PaymentTransactionServices, we must first create a Payment in PaymentTransactionServices. These Payments are most commonly created during the payment stage of your checkout flow.

The paymentMethodProperties is used to specify the properties required by Tabby to create the checkout session. See

{
  "amount": {
    "amount": 10,
    "currency": "KWD"
  },
  "gatewayType": "TABBY",
  "type": "BNPL",
  "ownerId": "{cart_id}",
  "ownerType": "BLC_CART",
  "owningUserEmailAddress": "card.success@tabby.ai",
  "owningUserType": "BLC_CUSTOMER",
  "billingAddress": {
    "fullName": "...",
    "addressLine1": "...",
    "addressLine2": "...",
    "city": "City name",
    "stateProvinceRegion": "WA",
    "country": "US",
    "postalCode": "12345",
    "phonePrimary": {
      "countryCode": null,
      "phoneNumber": "+96590000001",
      "extension": null
    },
    "default": false,
    "active": true
  },
  "paymentMethodProperties": {
    "bnpl_type": "PAY_IN_4", // (1)
    "payment": "{\"buyer\":{\"phone\":\"+96590000001\",\"email\":\"card.success@tabby.ai\",\"name\":\"Priscilla Riggs\"},\"shipping_address\":{\"city\":\"City name\",\"address\":\"44 Nobel Road\",\"zip\":\"12345\"},\"order\":{\"reference_id\":\"{cart_id}\",\"items\":[{\"title\":\"Test\",\"quantity\":1,\"unit_price\":\"10\",\"reference_id\":\"01HKQ0PE42ETEM1NAH678R0HQE\",\"category\":\"Top Sellers\"}]}}", // (2)
    "lang": "en",
    "merchant_urls": "{\"success\":\"https://heatclinic.localhost:8456/api/cart-operations/checkout/${cartId}/payment-callback/TABBY?tenantId=${tenantId}&applicationId=${applicationId}\",\"cancel\":\"https://heatclinic.localhost:8456/api/cart-operations/checkout/${cartId}/payment-callback/TABBY?tenantId=${tenantId}&applicationId=${applicationId}\",\"failure\":\"https://heatclinic.localhost:8456/api/cart-operations/checkout/${cartId}/payment-callback/TABBY?tenantId=${tenantId}&applicationId=${applicationId}\"}", // (3)
    "merchant_code": "{merchant_code}"
  }
}
  1. Optional. The Tabby payment type. Available values PAY_IN_4 and PAY_LATER. Version 1.0.0-GA supports only PAY_IN_4 which is used by default if not specified.

  2. The Tabby payment object serialized as a String.

  3. Used for redirecting the customer after the tabby HPP flow. Required for Web integration, optional for Mobile App integration.

  4. Collect Merchant codes from your Tabby Account manager. This value can be added in the configuration using broadleaf.tabby.merchant-code property if it can have only 1 value within 1 application. If it can be different for example, for different currencies, resolve the correct code and provide it via "merchant_code" attribute.

Add Buyer and Order History

The buyer_history and order_history is populated during the creation of the Payment in PaymentTransactionService. If the Tabby payment in the request doesn’t have the order history, com.broadleafcommerce.tabby.service.DefaultTabbyPaymentModificationService will read the Order history from the Order Ops service and based on this data it will update the Tabby payment specified in the paymentMethodProperties.

What Data is Populated?

Buyer History

  • buyer_history.registered_since - This value is populated by the oldest Order submit date if this value is not provided in the request, or if it is after the oldest order submit date

  • buyer_history.loyalty_level - The number of Orders submitted by the customer

Order History

  • order_history[0..n].purchased_at - The Order submit date - Order#submitDate

  • order_history[0..n].amount - The Order total payment amount - Order#orderPricing#total

  • order_history[0..n].status - By default, this value is always equal to complete. To change this value override DefaultTabbyPaymentModificationService.getTabbyOrderStatus

  • order_history[0..n].buyer.phone - The buyer phone number. Gathered from the shipping address of the Order fulfillment - OrderFulfillment#address#phonePrimary#phoneNumber

  • order_history[0..n].buyer.email - The customer email from Order#emailAddress

  • order_history[0..n].buyer.name - The customer full name from Order#customerName

  • order_history[0..n].shipping_address.city - OrderFulfillment#address#city

  • order_history[0..n].shipping_address.address - OrderFulfillment#address#addressLine1

  • order_history[0..n].shipping_address.zip - OrderFulfillment#address#postalCode