duckDodo Payments

Setup

1

Get your Dodo Payments credentials.

To use Dodo Payments, you need an API key. You can get them from the arrow-up-rightDodo Payments Dashboardarrow-up-right.

2

Configure the provider.

To configure the provider

import { BetterPay } from "better-pay"

const provider = new BetterPay({
    provider: 'dodopayments',
    apiKey: 'YOUR_DODO_PAYMENTS_API_KEY'
    isLive: false. // optional. By default true
})  

Usage

circle-info

To implement the complete payment flow. Checkout this demo apparrow-up-right.

Create payment

To create payment with dodo payments, you can use the createPayment function provided by the provider. It takes object with following properties:

chevron-rightPropertieshashtag
  1. Amount

  2. Currency

  3. Discount (optional)

  4. Name

  5. Email

  6. Phone Number (optional)

import { BetterPay } from "better-pay"

const provider = new BetterPay({
    provider: 'dodopayments',
    apiKey: 'YOUR_DODO_PAYMENTS_API_KEY'
    isLive: false // optional. By default true
})  

const response = await provider.createPayment({
    amount: 100,
    currency: 'USD',
    discount: 0
    name: '', 
    email: '',
    phoneNumber: // optional
})
chevron-rightResponsehashtag
  1. Product Id

  2. Customer Id

  3. Business Id

  4. Type


Confirm payment

To confirm payment with dodo payments, you can use the confirmPayment function provided by the provider. It takes object with following properties:

chevron-rightPropertieshashtag
  1. Customer Id

  2. Product Id

  3. Quantity (optional)

  4. City

  5. Country Iso Code

  6. State

  7. Street

  8. Zip Code

  9. Payment Link (optional)

  10. Return Url (optional)

  11. Metadata (optional)

chevron-rightResponsehashtag
  1. Payment Id

  2. Client Secret

  3. Payment Link (use this link to make payment)

  4. Type

To create payment link with dodo payments, you can use the createPaymentLink function provided by the provider. It takes object with following properties:

chevron-rightPropertieshashtag
  1. Amount

  2. Currency

  3. Discount (optional)

  4. Name

  5. Email

  6. Phone Number (optional)

  7. Quantity (optional)

  8. City

  9. Country Iso Code

  10. State

  11. Street

  12. Zip Code

  13. Payment Link (optional)

  14. Return Url (optional)

  15. Metadata (optional)

chevron-rightResponsehashtag
  1. Payment Id

  2. Client Secret

  3. Payment Link (use this link to make payment)

  4. Product Id

  5. Customer Id

  6. Business Id

  7. Type

Last updated