zarinpal-typescript
Advanced tools
Comparing version
{ | ||
"name": "zarinpal-typescript", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -19,3 +19,3 @@ Simple Zarinpal package written in TypeScript. | ||
// Get Authority | ||
const authority = await zp.requestPayment({ | ||
const request = await zp.requestPayment({ | ||
amount: 1000, | ||
@@ -25,7 +25,19 @@ callbackUrl: 'https://myCallbackUrl.com', | ||
}); | ||
// Check for errors | ||
if (request.errorMessage) { | ||
throw new Error(request.errorMessage); | ||
} | ||
// Get Payment Url | ||
const paymentUrl = zp.startPayment(authority); | ||
// Verify Payment | ||
const refId = await zp.verifyPayment({ amount: 1000, authority }); | ||
const verify = await zp.verifyPayment({ amount: 1000, authority }); | ||
// Check for errors | ||
if (verify.errorMessage) { | ||
throw new Error(verify.errorMessage); | ||
} | ||
})(); | ||
``` |
11980
1.79%42
40%