π±Dime Pay Flutter SDK
The official Flutter SDK for embedding the Dime Pay secure payment experience into native apps using WebView.
π Installation
flutter pub add dimepay_flutter_sdk
π§© Usage
Card Payments
DimePayWebView(
total: 5000,
currency: "JMD",
test: true,
orderId: "ORDER-001",
clientId: "ck_jtfEtqbrX2Nf7U_evqKVy",
is_subscription: false,
data: "<signed_jwt_token>",
payment_methods: {
apple_pay: true,
google_pay: true,
samsung_pay: true
},
styles: DimePayStyles(
primaryColor: "#936c6c",
buttonColor: "#936c6c",
buttonTextColor: "#FFFFFF",
backgroundColor: "#DDDDDD",
noBorderRadius: false,
),
onReady: (data) => print("β
Ready: \$data"),
onSuccess: (data) => print("β
Success: \$data"),
onFailed: (err) => print("β Failed: \$err"),
onError: (err) => print("β Error: \$err"),
onCancel: () => print("β οΈ Cancelled"),
onLoading: () => print("β³ Loading..."),
)
Save Card
DimePayCardView(
cardRequestToken: "<card_request_token>",
clientId: "ck_jtfEtqbrX2Nf7U_evqKVy",
origin: "https://yourorigin.com",
data: "<signed_jwt_token>",
styles: DimePayStyles(
primaryColor: "#936c6c",
buttonColor: "#936c6c",
buttonTextColor: "#FFFFFF",
backgroundColor: "#DDDDDD",
noBorderRadius: false,
),
onReady: (data) => print("β
Ready: \$data"),
onSuccess: (data) => print("β
Success: \$data"),
onFailed: (err) => print("β Failed: \$err"),
onError: (err) => print("β Error: \$err"),
onCancel: () => print("β οΈ Cancelled"),
onLoading: () => print("β³ Loading..."),
)
π Secure JWT Flow
You must pass a signed JWT to data prop containing transaction info. Sign this on your server.
π Secure Payment Flow with JWT
You must generate a signed JWT on your backend and pass it to the SDK via the data prop.
Example Card Payment Payload:
{
"id": "ORDER-001",
"total": 5000,
"subtotal": 5000,
"description": "This is an order from the sdk",
"tax": 0,
"currency": "JMD",
"fees": [],
"items": [{
"id": "xxxx-xxxx-xxxx-xxxx",
"price": 1060,
"sku": "ABCA-IAC",
"quantity": 1,
"shortDescription": "",
"name": "iMac",
"imageUrl": "https://example.com/images/xxxxxx.jpg",
"merchant_id": null, // Only required for Dime bridge
"selectedOptions": [
{
"name": "Color",
"value": "red",
"type": "CHOICE"
}
]
}],
"fulfilled": true,
"shippingPerson": {
"name": "Shamir Saddler",
"street": "1 Test Ave",
"city": "Kingston 6",
"stateOrProvinceName": "Kingston",
"postalCode": "00000",
"countryName": "Jamaica"
},
"billingPerson": {
"name": "Shamir Saddler",
"street": "1 Test Ave",
"city": "Kingston 6",
"stateOrProvinceName": "Kingston",
"postalCode": "00000",
"countryName": "Jamaica"
},
"split": null, // Only required for Dime bridge,
"webhookUrl": "https://yourservice.com/webhook"
}
For Dime Bridge, add the block below to the payload:
split: [
{
fee: 10,
merchant_id: 'm4D8mQ1wMrdTUIg',
amount: 500,
},
{
fee: 30,
merchant_id: 'm7UarSiV9zWxN6v',
amount: 1500,
}
]
Also for Dime bridge the corresponding item needs to be tagged with a merchant_id
Example Card Save Payload:
{
"webhookUrl": "https://webhook.com",
"card_request_token": "<card_request_token>",
}
Use a backend library like
jsonwebtokento sign the payload with your secret key. Never expose your secret key in your app.
βοΈ Configuration Options
Card Payment:
| Prop | Type | Required | Description |
|---|---|---|---|
total |
number |
β | The total amount to charge |
currency |
string |
β | The currency code (e.g. JMD, USD) |
order_id |
string |
β | Your order reference |
client_id |
string |
β | Client ID for your integration |
data |
string |
β | Signed JWT with payment details |
payment_methods |
object |
optional | Defines payment methods to enable |
styles |
object |
optional | Customizes UI (colors, border radius, etc.) |
test |
boolean |
optional | Set true for sandbox environment |
onReady |
func |
optional | Called when payment page is ready |
onSuccess |
func |
optional | Called when payment completes successfully |
onFailed |
func |
optional | Called if payment fails |
onError |
func |
optional | Called on internal error |
onCancel |
func |
optional | Called when user cancels |
onLoading |
func |
optional | Called when payment widget begins loading |
Card Save:
| Prop | Type | Required | Description |
|---|---|---|---|
cardRequestToken |
string |
β | The total amount to charge |
clientId |
string |
β | The currency code (e.g. JMD, USD) |
origin |
string |
β | Your order reference |
clientId |
string |
β | Client ID for your integration |
data |
string |
β | Signed JWT with payment details |
styles |
object |
optional | Customizes UI (colors, border radius, etc.) |
test |
boolean |
optional | Set true for sandbox environment |
onReady |
func |
optional | Called when payment page is ready |
onSuccess |
func |
optional | Called when payment completes successfully |
onFailed |
func |
optional | Called if payment fails |
onError |
func |
optional | Called on internal error |
onCancel |
func |
optional | Called when user cancels |
onLoading |
func |
optional | Called when payment widget begins loading |
π§Ύ Changelog
1.0.7 - 2025-1-29
Add color customization for label text
1.0.6 - 2025-12-30
Add support for Dime V2 Update urls to pay.*
1.0.3 - 2025-07-07
- Add support for Card Tokenization
1.0.2 - 2025-06-26
- Add support for Apple Pay, Google Pay, Samsung Pay
1.0.0 - 2025-05-14
- π Initial release
- β Supports full payment flow with JWT + WebView
- π‘ Handles events:
onReady,onSuccess,onError,onCancel, etc.
π‘οΈ License
MIT License Β© Dime Pay
βοΈ Setup Local
- Download Flutter from https://docs.flutter.dev/get-started/install/windows/desktop
- Download java 17.0.12
- Download android studio
- Download vscode
- Run commands to setup
flutter create .flutter pub get
βοΈ Run Local
- Run
flutter emulatorto see all emulators - Run
flutter emulators --launch <emulator id>to open an emulator - Run commands to start application
flutter run
- Run commands to test
flutter test