whish-payment
v1.0.2
Published
TypeScript-based payment service integration with APIs for balance inquiries, payment link generation, and status tracking, supporting USD, LBP, and AED currencies.
Readme
Wish Payment SDK
A TypeScript SDK for interacting with the Wish Payment API.
Installation
npm install whish-payment-sdkError Handling
The SDK throws a custom WishPaymentApiError when an API request fails. This error contains the following properties:
message: A human-readable error message.statusCode: The HTTP status code of the response.code: An API-specific error code (if available).details: Additional error details (if available).
Example:
try {
const balance = await client.getBalance();
} catch (error) {
if (error instanceof WishPaymentApiError) {
console.error("API Error:", error.toJSON());
} else {
console.error("Unexpected Error:", error);
}
}Example Output:
{
"name": "WishPaymentApiError",
"message": "Invalid API key",
"statusCode": 401,
"code": "UNAUTHORIZED",
"details": null
}