Last updated 6 days ago
This provider supports single method. Users can directly Confirm Payment.
To use Square, you need an API token. You can get them from the .
To configure the provider
import { BetterPay } from "better-pay" const provider = new BetterPay({ provider: 'square', apiToken: 'YOUR_SQUARE_API_TOKEN' })
To implement the complete payment flow. Checkout this .
To confirm payment with square, you can use the confirmPayment function provided by the client. It takes object with following properties:
confirmPayment
Source Id
Amount
Currency
import { BetterPay } from "better-pay" const provider = new BetterPay({ provider: 'square', apiToken: 'YOUR_SQUARE_API_TOKEN' }) const response = await provider.confirmPayment({ sourceId: 'YOUR_SQUARE_SOURCE_ID', amount: 1000, currency: 'USD' })
PaymentI Id
Order Id
Status
Type