mercy_pay library
La bibliothèque Dart officielle de l'API Mercy Pay, pour vos serveurs.
Classes
- AccountResource
- BillingPortalResource
- CheckoutSessionsResource
- CustomersResource
- EmbedDomainsResource
- EventsResource
- FeesResource
- InvoicesResource
- MercyPay
- The entry point: one client per API key. For your Dart server only: an app never holds the key (see mercy_pay_flutter).
- MercyPayCatalog
- The open countries, their mobile money operators and the webhook event types. A new operator may appear before this list knows it: any code stays accepted.
- Page
- One page of a list, newest first. data is this page; autoPaging goes through every page, fetched as you go.
- PaymentLinksResource
- PaymentsResource
- PayoutsResource
- PlansResource
- ProviderStatusResource
- RefundsResource
- RequestLogsResource
- SubscriptionsResource
- TestHelpersResource
- WalletsResource
- WalletTransfersResource
- WebhookEndpointsResource
Constants
- defaultToleranceSeconds → const int
- version → const String
Functions
-
constructEvent(
String payload, String? header, String secret, {int tolerance = defaultToleranceSeconds, int? now}) → Map< String, dynamic> - Verifies the signature, then returns the event. Pass the raw body exactly as received.
-
encodeQuery(
Map< String, Object?> params) → String -
Nested parameters the way the API reads them: created
gte=…, expand[]=… -
verifySignature(
String payload, String? header, String secret, {int tolerance = defaultToleranceSeconds, int? now}) → void - Checks the MercyPay-Signature header: an HMAC-SHA256 of "{t}.{raw body}" with the endpoint's secret, and t recent.
Exceptions / Errors
- ApiException
- An error answered by the API. Branch on code (stable), never on message. Quote requestId to the Mercy Pay support.
- ApiServerException
- A problem on Mercy Pay's side. Retry later with the same idempotency key.
- AuthenticationException
- A missing, wrong or revoked key, or live mode before the account is verified.
- ConnectionException
- No answer from Mercy Pay. Send the request again with the same idempotency key.
- IdempotencyException
- The idempotency key is missing, reused with other content, or still in use.
- InvalidRequestException
- A refused parameter, an object not found, an action not allowed.
- MercyPayException
- Everything this library throws.
- PaymentException
- Refused by the operator or the bank, or a balance too low.
- RateLimitException
- Too many requests: slow down.
- SignatureVerificationException
- A webhook whose signature is missing, wrong or too old: answer 400 and ignore it.
- WaitTimeoutException
- The wait ended before the object reached a final status. Its last state is in last.