To confirm payment with dodo payments, you can use the confirmPayment function provided by the provider. It takes object with following properties:
Properties
Customer Id
Product Id
Quantity (optional)
City
Country Iso Code
State
Street
Zip Code
Payment Link (optional)
Return Url (optional)
Metadata (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.confirmPayment({
quantity: 1 // optional. By default set to 1
city: 'USER_CITY',
countryIsoCode: 'USER_COUNTRY_ISO_CODE',
state: 'USER_STATE',
street: 'USER_STREET',
zipCode: 'USER_ZIP_CODE',
paymentLink: true, // One time payment link. By default false.
returnUrl: 'YOUR_RETURN_URL_AFTER_SUCCESSFULL_PAYMENT', //optional
});
Response
Payment Id
Client Secret
Payment Link (use this link to make payment)
Type
Dodo Payments Payment Link.
Create payment link
To create payment link with dodo payments, you can use the createPaymentLink function provided by the provider. It takes object with following properties:
Properties
Amount
Currency
Discount (optional)
Name
Email
Phone Number (optional)
Quantity (optional)
City
Country Iso Code
State
Street
Zip Code
Payment Link (optional)
Return Url (optional)
Metadata (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.createPaymentLink({
amount: [100], // You can add for multiple products.
currency: 'USD',
discount: [0] // optional. BY default 0. You can add for multiple products.
name: '',
email: '',
phoneNumber: // optional
quantity: [1] // optional. By default set to 1. You can add for multiple products.
city: 'USER_CITY',
countryIsoCode: 'USER_COUNTRY_ISO_CODE',
state: 'USER_STATE',
street: 'USER_STREET',
zipCode: 'USER_ZIP_CODE',
paymentLink: true, // One time payment link. By default false.
returnUrl: 'YOUR_RETURN_URL_AFTER_SUCCESSFULL_PAYMENT', // optional
});