Skip to content

Latest commit

 

History

History
83 lines (60 loc) · 1.95 KB

File metadata and controls

83 lines (60 loc) · 1.95 KB

MakePay Dart SDK

Dart and Flutter-friendly SDK for MakePay payment links, checkout URLs, bookkeeping, and webhook verification.

The package is pure Dart so it can be used from Flutter apps, Dart web apps, CLIs, and server-side Dart services. Keep MakePay partner credentials on trusted backends; Flutter apps should use checkout URL helpers and call your backend relay for payment-link creation.

Installation

The package is planned for pub.dev as:

dependencies:
  makepay: ^0.1.0

Until the first pub.dev release, reference this repository or publish it to your internal package registry.

Server-Side Quick Start

final makePay = MakePayClient(
  MakePayClientOptions(
    keyId: Platform.environment['MAKEPAY_KEY_ID']!,
    keySecret: Platform.environment['MAKEPAY_KEY_SECRET']!,
  ),
);

final created = await makePay.createPaymentLink(
  const PaymentLinkPayload(
    title: 'Order #1042',
    amount: '129.99',
    currency: 'USDT',
    customerEmail: 'buyer@example.com',
  ),
);

Flutter Checkout URLs

const urls = MakePayCheckoutUrls();

final hosted = urls.hostedPayment('pay_123');
final embedded = urls.embeddedPayment(
  'pay_123',
  parentOrigin: 'https://merchant.example',
);

Open the URL with your app's preferred launcher package.

Webhooks

Read the exact raw body before parsing JSON:

const verifier = MakePayWebhookVerifier(webhookSecret: 'whsec_live_or_test');

final trusted = verifier.verify(rawBodyBytes, signatureHeader);

The verifier expects the t=<timestamp>,v1=<hex> signature format and applies a five-minute tolerance by default.

Bookkeeping

final summary = await makePay.getBookkeepingSummary();
final invoiceLink = await makePay.createBookkeepingInvoicePaymentLink(
  'inv_123',
  sendPaymentRequestEmail: true,
);

Validation

dart pub get
dart format --set-exit-if-changed .
dart analyze --fatal-infos
dart test

Maintainer: Ethan Carter (makepayio).