@payabli/component-contracts 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -6
- package/dist/payin/schema.d.ts +34 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -386,16 +386,21 @@ const payin = payabli.create('payin', {
|
|
|
386
386
|
#### Success and errors
|
|
387
387
|
|
|
388
388
|
`success` and React's `onSuccess` report confirmed success only. `submit()` resolves with the same result data.
|
|
389
|
-
`PayInSuccessPayload
|
|
390
|
-
The wire success data remains an open record. The SDK preserves fields it does not interpret.
|
|
391
|
-
|
|
392
|
-
For tokenize sessions, `SUBMIT_RESULT.data`, the `success` event, and the `submit()` result contain:
|
|
389
|
+
The payload is `PayInSuccessPayload`, one closed shape for every operation:
|
|
393
390
|
|
|
394
391
|
```ts
|
|
395
|
-
{
|
|
392
|
+
{
|
|
393
|
+
operation: 'pay' | 'auth' | 'tokenize',
|
|
394
|
+
method: 'card' | 'ach' | 'check' | 'applepay' | 'googlepay',
|
|
395
|
+
transactionId?: string, // pay, auth
|
|
396
|
+
storedMethodId?: string, // tokenize; pay or auth that saved the method
|
|
397
|
+
customerId?: number, // when the API created or matched a customer
|
|
398
|
+
paymentMethod?: { maskedAccount?, accountType?, expiration?, holderName? },
|
|
399
|
+
amount?: { total: number, serviceFee?: number, currency?: string }, // pay, auth
|
|
400
|
+
}
|
|
396
401
|
```
|
|
397
402
|
|
|
398
|
-
`
|
|
403
|
+
`transactionId` is the Payabli transaction id. `storedMethodId` is the saved payment method id: pass it back as `storedMethodId` on a later payment. The API response body does not reach the page.
|
|
399
404
|
|
|
400
405
|
A failed `SUBMIT_RESULT` rejects `submit()` and emits `error`, mapped to React's `onError`.
|
|
401
406
|
Errors have `{ code, message, recoverable, details? }`. The SDK forwards the code and message unchanged.
|
package/dist/payin/schema.d.ts
CHANGED
|
@@ -92,13 +92,41 @@ export declare const payinEvents: {
|
|
|
92
92
|
vendorId: z.ZodMiniString<string>;
|
|
93
93
|
}, z.core.$strip>;
|
|
94
94
|
};
|
|
95
|
+
/** The session operation the payload reports on. */
|
|
96
|
+
export type PayInOperation = 'pay' | 'auth' | 'tokenize';
|
|
95
97
|
/**
|
|
96
|
-
* SUBMIT_RESULT.data for PayIn
|
|
97
|
-
*
|
|
98
|
+
* SUBMIT_RESULT.data for PayIn: the `success` event payload and the `submit()`
|
|
99
|
+
* result. One closed shape for every operation, so a partner handles the
|
|
100
|
+
* result without branching on the operation. payhub builds it from the API
|
|
101
|
+
* result; the API body itself never reaches the page.
|
|
98
102
|
*/
|
|
99
103
|
export type PayInSuccessPayload = {
|
|
100
|
-
|
|
104
|
+
operation: PayInOperation;
|
|
105
|
+
/** The method the buyer used. */
|
|
106
|
+
method: PaymentMethodName;
|
|
107
|
+
/** The Payabli transaction id. Present for `pay` and `auth`. */
|
|
101
108
|
transactionId?: string;
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
/**
|
|
110
|
+
* The saved payment method id. Present for `tokenize`, and for `pay` or `auth`
|
|
111
|
+
* when the session saved the method. Pass it back as `storedMethodId` on a
|
|
112
|
+
* later payment.
|
|
113
|
+
*/
|
|
114
|
+
storedMethodId?: string;
|
|
115
|
+
/** The Payabli customer id when the API created or matched a customer. */
|
|
116
|
+
customerId?: number;
|
|
117
|
+
paymentMethod?: {
|
|
118
|
+
/** The account with every digit but the last four hidden, for example `5XXXXXXXXXXX0055`. */
|
|
119
|
+
maskedAccount?: string;
|
|
120
|
+
/** The card brand (`mastercard`) or the bank account type (`checking`). */
|
|
121
|
+
accountType?: string;
|
|
122
|
+
/** The card expiration, `MM/YY`. */
|
|
123
|
+
expiration?: string;
|
|
124
|
+
holderName?: string;
|
|
125
|
+
};
|
|
126
|
+
/** The charged or authorized amount. Present for `pay` and `auth`. */
|
|
127
|
+
amount?: {
|
|
128
|
+
total: number;
|
|
129
|
+
serviceFee?: number;
|
|
130
|
+
currency?: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
package/package.json
CHANGED