@inkress/admin-sdk 1.1.45 → 1.1.47
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 +247 -13
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +100 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +100 -7
- package/dist/index.js.map +1 -1
- package/dist/resources/checkout-sessions.d.ts +201 -0
- package/dist/resources/checkout-sessions.d.ts.map +1 -0
- package/dist/resources/kyc.d.ts +1 -19
- package/dist/resources/kyc.d.ts.map +1 -1
- package/dist/resources/merchants.d.ts +35 -1
- package/dist/resources/merchants.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ import { InkressSDK } from '@inkress/admin-sdk';
|
|
|
42
42
|
|
|
43
43
|
const inkress = new InkressSDK({
|
|
44
44
|
accessToken: 'your-jwt-token',
|
|
45
|
-
username: 'merchant-username', // Optional
|
|
45
|
+
username: 'merchant-username', // Optional - only needed for merchant operations
|
|
46
46
|
mode: 'live', // Optional - 'live' (default) or 'sandbox'
|
|
47
47
|
});
|
|
48
48
|
```
|
|
@@ -222,6 +222,7 @@ The SDK provides access to 23+ fully-typed resources:
|
|
|
222
222
|
- **Subscriptions** - Recurring billing and subscriptions
|
|
223
223
|
- **Payment Links** - Payment link generation
|
|
224
224
|
- **Payment Methods** - Payment method configuration
|
|
225
|
+
- **Checkout Sessions** - Embedded checkout for card payments
|
|
225
226
|
|
|
226
227
|
### Financial
|
|
227
228
|
- **Financial Accounts** - Account management
|
|
@@ -302,6 +303,26 @@ const invoices = await inkress.merchants.invoices();
|
|
|
302
303
|
const invoice = await inkress.merchants.invoice('invoice-123');
|
|
303
304
|
// Returns: MerchantInvoice
|
|
304
305
|
|
|
306
|
+
// Request bank account update (initiates OTP verification)
|
|
307
|
+
const updateRequest = await inkress.merchants.updateBankInfo({
|
|
308
|
+
account_holder_name: 'John Doe',
|
|
309
|
+
account_holder_type: 'Personal', // 'Personal' | 'Business'
|
|
310
|
+
account_number: 123456789,
|
|
311
|
+
account_type: 'Checking', // 'Checking' | 'Saving'
|
|
312
|
+
bank_name: 'First National Bank',
|
|
313
|
+
branch_name: 'Main Branch',
|
|
314
|
+
branch_code: '001', // Optional
|
|
315
|
+
routing_number: '021000021', // Optional
|
|
316
|
+
swift_code: 'FNBKUS33', // Optional
|
|
317
|
+
country_code: 'JM',
|
|
318
|
+
currency_code: 'JMD'
|
|
319
|
+
});
|
|
320
|
+
// Returns: { message: string | null, success: boolean, error: string | null, reason: string | null }
|
|
321
|
+
|
|
322
|
+
// Confirm bank account update with OTP code
|
|
323
|
+
const confirmResult = await inkress.merchants.confirmBankInfo('123456');
|
|
324
|
+
// Returns: { account: FinancialAccount | null, saved: boolean, success: boolean, error: string | null, reason: string | null }
|
|
325
|
+
|
|
305
326
|
// Query builder
|
|
306
327
|
const merchants = await inkress.merchants
|
|
307
328
|
.createQueryBuilder()
|
|
@@ -682,6 +703,231 @@ await inkress.paymentLinks.update(linkId, { amount: 89.99 });
|
|
|
682
703
|
await inkress.paymentLinks.delete(linkId);
|
|
683
704
|
```
|
|
684
705
|
|
|
706
|
+
### Checkout Sessions (Embedded Checkout)
|
|
707
|
+
|
|
708
|
+
Checkout Sessions enable embedded payment forms that can be integrated directly into your website via an iframe. This provides a seamless checkout experience without redirecting customers away from your site.
|
|
709
|
+
|
|
710
|
+
```typescript
|
|
711
|
+
// Create a checkout session
|
|
712
|
+
const session = await inkress.checkoutSessions.create({
|
|
713
|
+
reference_id: 'order-123',
|
|
714
|
+
total: 100.00,
|
|
715
|
+
kind: 'online',
|
|
716
|
+
currency_code: 'JMD',
|
|
717
|
+
title: 'Premium Subscription',
|
|
718
|
+
customer: {
|
|
719
|
+
email: 'customer@example.com',
|
|
720
|
+
first_name: 'John',
|
|
721
|
+
last_name: 'Doe',
|
|
722
|
+
phone: '+1234567890'
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
// Access the iframe URL for embedding
|
|
727
|
+
const iframeUrl = session.result.frame_url;
|
|
728
|
+
const sessionId = session.result.session_id;
|
|
729
|
+
|
|
730
|
+
// Get session details
|
|
731
|
+
const details = await inkress.checkoutSessions.get('S.75a29ad32e52');
|
|
732
|
+
console.log(details.result.status); // 'pending', 'awaiting_payment', 'completed', etc.
|
|
733
|
+
|
|
734
|
+
// Cancel a session
|
|
735
|
+
await inkress.checkoutSessions.delete('S.75a29ad32e52');
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
#### Embedding the Checkout Iframe
|
|
739
|
+
|
|
740
|
+
The checkout session returns a `frame_url` that you can embed in your page:
|
|
741
|
+
|
|
742
|
+
```html
|
|
743
|
+
<!-- Embed the checkout iframe -->
|
|
744
|
+
<iframe
|
|
745
|
+
id="inkress-checkout"
|
|
746
|
+
src="https://inkress.com/checkout/session/S.75a29ad32e52"
|
|
747
|
+
style="width: 100%; height: 600px; border: none;"
|
|
748
|
+
allow="payment"
|
|
749
|
+
></iframe>
|
|
750
|
+
```
|
|
751
|
+
|
|
752
|
+
#### Handling Checkout Events
|
|
753
|
+
|
|
754
|
+
The embedded checkout iframe emits two important `postMessage` events that your application should listen for:
|
|
755
|
+
|
|
756
|
+
| Event | Description | When Fired |
|
|
757
|
+
|-------|-------------|------------|
|
|
758
|
+
| `frame_unload` | User has entered card information | Card details submitted to payment processor |
|
|
759
|
+
| `payment_posted` | Payment attempt completed | After 3DS verification or payment processing |
|
|
760
|
+
|
|
761
|
+
```typescript
|
|
762
|
+
const session_id = mySession.id;
|
|
763
|
+
// Listen for checkout events from the iframe
|
|
764
|
+
window.addEventListener('message', (event) => {
|
|
765
|
+
// Verify the origin for security
|
|
766
|
+
if (event.origin !== 'https://inkress.com') {
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
const { type, data } = event.data;
|
|
771
|
+
|
|
772
|
+
switch (type) {
|
|
773
|
+
case 'frame_unload':
|
|
774
|
+
// User has entered their card information
|
|
775
|
+
// The iframe is processing the payment
|
|
776
|
+
console.log('Payment processing started...');
|
|
777
|
+
expandFrameFor3DS();
|
|
778
|
+
break;
|
|
779
|
+
|
|
780
|
+
case 'payment_posted':
|
|
781
|
+
// Payment attempt has completed
|
|
782
|
+
// Check the session status to determine outcome
|
|
783
|
+
handlePaymentResult();
|
|
784
|
+
break;
|
|
785
|
+
}
|
|
786
|
+
});
|
|
787
|
+
|
|
788
|
+
async function handlePaymentResult() {
|
|
789
|
+
// Fetch the updated session to get the final status
|
|
790
|
+
const session = await inkress.checkoutSessions.get(dsession_id);
|
|
791
|
+
|
|
792
|
+
if (session.result.status === 'completed') {
|
|
793
|
+
// Payment successful!
|
|
794
|
+
showSuccessMessage();
|
|
795
|
+
redirectToConfirmation(session.result.order_id);
|
|
796
|
+
} else {
|
|
797
|
+
// Payment failed or requires action
|
|
798
|
+
showErrorMessage('Payment could not be completed. Please try again.');
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
#### Complete Integration Example
|
|
804
|
+
|
|
805
|
+
```typescript
|
|
806
|
+
import { InkressSDK } from '@inkress/admin-sdk';
|
|
807
|
+
|
|
808
|
+
const inkress = new InkressSDK({
|
|
809
|
+
accessToken: 'your-jwt-token',
|
|
810
|
+
username: 'your-merchant'
|
|
811
|
+
});
|
|
812
|
+
|
|
813
|
+
async function initializeCheckout(orderData: {
|
|
814
|
+
total: number;
|
|
815
|
+
currency: string;
|
|
816
|
+
customer: { email: string; firstName: string; lastName: string; phone: string };
|
|
817
|
+
}) {
|
|
818
|
+
// 1. Create the checkout session
|
|
819
|
+
const session = await inkress.checkoutSessions.create({
|
|
820
|
+
reference_id: `${Math.random().toString(36).substring(2, 9)}`,
|
|
821
|
+
total: orderData.total,
|
|
822
|
+
kind: 'online',
|
|
823
|
+
currency_code: orderData.currency,
|
|
824
|
+
title: 'Your Order',
|
|
825
|
+
customer: {
|
|
826
|
+
email: orderData.customer.email,
|
|
827
|
+
first_name: orderData.customer.firstName,
|
|
828
|
+
last_name: orderData.customer.lastName,
|
|
829
|
+
phone: orderData.customer.phone
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
// 2. Store session details for later reference
|
|
834
|
+
const sessionId = session.result.session_id;
|
|
835
|
+
const expiresAt = session.result.expires;
|
|
836
|
+
|
|
837
|
+
// 3. Display the checkout iframe
|
|
838
|
+
const iframe = document.createElement('iframe');
|
|
839
|
+
iframe.src = session.result.frame_url;
|
|
840
|
+
iframe.style.cssText = 'width: 100%; height: 600px; border: none;';
|
|
841
|
+
iframe.allow = 'payment';
|
|
842
|
+
document.getElementById('checkout-container')!.appendChild(iframe);
|
|
843
|
+
|
|
844
|
+
// 4. Set up event listeners
|
|
845
|
+
window.addEventListener('message', async (event) => {
|
|
846
|
+
if (event.origin !== 'https://inkress.com') return;
|
|
847
|
+
|
|
848
|
+
const { type } = event.data;
|
|
849
|
+
|
|
850
|
+
if (type === 'frame_unload') {
|
|
851
|
+
// Show loading state while payment processes
|
|
852
|
+
document.getElementById('loading-overlay')!.style.display = 'flex';
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
if (type === 'payment_posted') {
|
|
856
|
+
// Check final payment status
|
|
857
|
+
const updatedSession = await inkress.checkoutSessions.get(sessionId);
|
|
858
|
+
|
|
859
|
+
if (updatedSession.result.status === 'completed') {
|
|
860
|
+
window.location.href = `/order-confirmation?order=${updatedSession.result.order_id}`;
|
|
861
|
+
} else {
|
|
862
|
+
document.getElementById('loading-overlay')!.style.display = 'none';
|
|
863
|
+
alert('Payment failed. Please try again.');
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
// 5. Handle session expiration
|
|
869
|
+
const timeUntilExpiry = expiresAt - Date.now();
|
|
870
|
+
setTimeout(() => {
|
|
871
|
+
alert('Your checkout session has expired. Please try again.');
|
|
872
|
+
window.location.reload();
|
|
873
|
+
}, timeUntilExpiry);
|
|
874
|
+
|
|
875
|
+
return { sessionId, expiresAt };
|
|
876
|
+
}
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
#### Session Response Structure
|
|
880
|
+
|
|
881
|
+
```typescript
|
|
882
|
+
interface CreateCheckoutSessionResponse {
|
|
883
|
+
session_id: string; // e.g., 'S.75a29ad32e52'
|
|
884
|
+
reference_id: string; // Your order reference
|
|
885
|
+
status: string; // 'pending'
|
|
886
|
+
order_id: string; // Internal order ID
|
|
887
|
+
currency: string; // e.g., 'JMD'
|
|
888
|
+
currency_code: string; // e.g., 'JMD'
|
|
889
|
+
created_at: string; // ISO timestamp
|
|
890
|
+
payment_initiated_at: string; // ISO timestamp
|
|
891
|
+
completed_at: string | null; // null until completed
|
|
892
|
+
expires: number; // Expiration timestamp (ms)
|
|
893
|
+
|
|
894
|
+
// Payment totals breakdown
|
|
895
|
+
totals: {
|
|
896
|
+
sub_total: number;
|
|
897
|
+
customer_total: number; // Amount customer pays
|
|
898
|
+
merchant_total: number; // Amount merchant receives
|
|
899
|
+
platform_total: number;
|
|
900
|
+
provider_total: number;
|
|
901
|
+
shipping_total: number;
|
|
902
|
+
tax_total: number;
|
|
903
|
+
discount_total: number;
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
// Customer info
|
|
907
|
+
customer: {
|
|
908
|
+
id: number | null;
|
|
909
|
+
email: string;
|
|
910
|
+
first_name: string;
|
|
911
|
+
last_name: string;
|
|
912
|
+
phone: string;
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
// Iframe and payment data
|
|
916
|
+
frame_url: string; // URL to embed in iframe
|
|
917
|
+
redirect_data: string; // 3DS redirect HTML (if needed)
|
|
918
|
+
spi_token: string; // Payment processor token
|
|
919
|
+
transaction_id: string; // Transaction UUID
|
|
920
|
+
amount: number; // Total amount
|
|
921
|
+
|
|
922
|
+
// Additional fields
|
|
923
|
+
title: string;
|
|
924
|
+
products: any[];
|
|
925
|
+
transaction_type: string | null;
|
|
926
|
+
three_d_secure: any | null;
|
|
927
|
+
is_subscription: boolean;
|
|
928
|
+
}
|
|
929
|
+
```
|
|
930
|
+
|
|
685
931
|
### Financial Accounts
|
|
686
932
|
|
|
687
933
|
```typescript
|
|
@@ -929,18 +1175,6 @@ await inkress.kyc.uploadDocument({
|
|
|
929
1175
|
notes: 'Government-issued ID card'
|
|
930
1176
|
}
|
|
931
1177
|
});
|
|
932
|
-
|
|
933
|
-
// Update bank information
|
|
934
|
-
await inkress.kyc.updateBankInfo({
|
|
935
|
-
kind: 'bank_info_update',
|
|
936
|
-
status: 'pending',
|
|
937
|
-
data: {
|
|
938
|
-
account_number: '123456789',
|
|
939
|
-
routing_number: '987654321',
|
|
940
|
-
bank_name: 'Example Bank',
|
|
941
|
-
account_holder_name: 'John Doe'
|
|
942
|
-
}
|
|
943
|
-
});
|
|
944
1178
|
```
|
|
945
1179
|
|
|
946
1180
|
### Complete Onboarding Flow Example
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { FeesResource } from './resources/fees';
|
|
|
20
20
|
import { PaymentMethodsResource } from './resources/payment-methods';
|
|
21
21
|
import { TransactionEntriesResource } from './resources/transaction-entries';
|
|
22
22
|
import { GenericsResource } from './resources/generics';
|
|
23
|
+
import { CheckoutSessionsResource } from './resources/checkout-sessions';
|
|
23
24
|
/**
|
|
24
25
|
* Main Inkress Commerce API SDK class
|
|
25
26
|
*
|
|
@@ -86,6 +87,7 @@ export declare class InkressSDK {
|
|
|
86
87
|
readonly paymentMethods: PaymentMethodsResource;
|
|
87
88
|
readonly transactionEntries: TransactionEntriesResource;
|
|
88
89
|
readonly generics: GenericsResource;
|
|
90
|
+
readonly checkoutSessions: CheckoutSessionsResource;
|
|
89
91
|
constructor(config: InkressConfig);
|
|
90
92
|
/**
|
|
91
93
|
* Update the SDK configuration
|
|
@@ -100,6 +102,8 @@ export * from './types';
|
|
|
100
102
|
export * from './client';
|
|
101
103
|
export type { WebhookPayload, WebhookVerificationOptions, IncomingWebhookRequest, } from './resources/webhook-urls';
|
|
102
104
|
export { KYC_DOCUMENT_REQUIREMENTS, type EntityType, type KycDocumentType, type KycDocumentStatus, type KycRequirements, } from './resources/kyc';
|
|
105
|
+
export type { CheckoutSession, CheckoutSessionStatus, CheckoutSessionFees, CheckoutSessionFeeMapping, CheckoutSessionTotals, CheckoutSessionCurrency, CheckoutSessionCustomer, CreateCheckoutSessionResponseData, DeleteCheckoutSessionResponseData, } from './resources/checkout-sessions';
|
|
106
|
+
export type { BankInfoUpdateRequestData, BankAccountUpdateRequestResponse, BankAccountUpdateConfirmResponse, } from './resources/merchants';
|
|
103
107
|
export { InkressSDK as default };
|
|
104
108
|
export type { OrderQueryParams, ProductQueryParams, UserQueryParams, MerchantQueryParams, CategoryQueryParams, BillingPlanQueryParams, SubscriptionQueryParams, PaymentLinkQueryParams, FinancialAccountQueryParams, FinancialRequestQueryParams, WebhookUrlQueryParams, TokenQueryParams, AddressQueryParams, CurrencyQueryParams, ExchangeRateQueryParams, FeeQueryParams, PaymentMethodQueryParams, TransactionEntryQueryParams, OrderFilterParams, ProductFilterParams, UserFilterParams, MerchantFilterParams, CategoryFilterParams, BillingPlanFilterParams, SubscriptionFilterParams, PaymentLinkFilterParams, FinancialAccountFilterParams, FinancialRequestFilterParams, WebhookUrlFilterParams, TokenFilterParams, AddressFilterParams, CurrencyFilterParams, ExchangeRateFilterParams, FeeFilterParams, PaymentMethodFilterParams, TransactionEntryFilterParams, OrderListResponse, ProductListResponse, UserListResponse, MerchantListResponse, CategoryListResponse, BillingPlanListResponse, SubscriptionListResponse, PaymentLinkListResponse, FinancialAccountListResponse, FinancialRequestListResponse, WebhookUrlListResponse, TokenListResponse, AddressListResponse, CurrencyListResponse, ExchangeRateListResponse, FeeListResponse, PaymentMethodListResponse, TransactionEntryListResponse, PageInfo, } from './types/resources';
|
|
105
109
|
export { ORDER_FIELD_TYPES, PRODUCT_FIELD_TYPES, USER_FIELD_TYPES, MERCHANT_FIELD_TYPES, CATEGORY_FIELD_TYPES, BILLING_PLAN_FIELD_TYPES, SUBSCRIPTION_FIELD_TYPES, PAYMENT_LINK_FIELD_TYPES, FINANCIAL_ACCOUNT_FIELD_TYPES, FINANCIAL_REQUEST_FIELD_TYPES, WEBHOOK_URL_FIELD_TYPES, TOKEN_FIELD_TYPES, ADDRESS_FIELD_TYPES, CURRENCY_FIELD_TYPES, EXCHANGE_RATE_FIELD_TYPES, FEE_FIELD_TYPES, PAYMENT_METHOD_FIELD_TYPES, TRANSACTION_ENTRY_FIELD_TYPES, } from './types/resources';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EA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xB,eAAe,EACf,yBAAyB,EACzB,4BAA4B,EAC5B,KAAK,SAAS,GACf,MAAM,wBAAwB,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -2403,6 +2403,18 @@ class MerchantsResource {
|
|
|
2403
2403
|
async invoice(invoiceId) {
|
|
2404
2404
|
return this.client.post(`/merchants/account/invoice/${invoiceId}`);
|
|
2405
2405
|
}
|
|
2406
|
+
/**
|
|
2407
|
+
* Request for bank account update
|
|
2408
|
+
*/
|
|
2409
|
+
async updateBankInfo(data) {
|
|
2410
|
+
return this.client.post('/merchants/bank_account/update_request', { bank_account: data });
|
|
2411
|
+
}
|
|
2412
|
+
/**
|
|
2413
|
+
* Confirm bank account information update with OTP codde
|
|
2414
|
+
*/
|
|
2415
|
+
async confirmBankInfo(otp) {
|
|
2416
|
+
return this.client.post('/merchants/bank_account/update_confirm', { otp });
|
|
2417
|
+
}
|
|
2406
2418
|
/**
|
|
2407
2419
|
* Query merchants with enhanced query support
|
|
2408
2420
|
* @example
|
|
@@ -3598,13 +3610,6 @@ class KycResource {
|
|
|
3598
3610
|
async uploadDocument(data) {
|
|
3599
3611
|
return this.client.post('/legal_requests', data);
|
|
3600
3612
|
}
|
|
3601
|
-
/**
|
|
3602
|
-
* Update bank information
|
|
3603
|
-
* Requires Client-Id header to be set in the configuration
|
|
3604
|
-
*/
|
|
3605
|
-
async updateBankInfo(data) {
|
|
3606
|
-
return this.client.post('/legal_requests', data);
|
|
3607
|
-
}
|
|
3608
3613
|
// ============================================================================
|
|
3609
3614
|
// KYC DOCUMENT REQUIREMENTS & STATUS
|
|
3610
3615
|
// ============================================================================
|
|
@@ -4852,6 +4857,93 @@ class GenericsResource {
|
|
|
4852
4857
|
}
|
|
4853
4858
|
}
|
|
4854
4859
|
|
|
4860
|
+
/**
|
|
4861
|
+
* Checkout Sessions Resource
|
|
4862
|
+
*
|
|
4863
|
+
* Handles creation and management of checkout sessions for payments.
|
|
4864
|
+
* Checkout sessions provide a way to create temporary payment sessions
|
|
4865
|
+
* with pre-calculated fees and payment URLs.
|
|
4866
|
+
*/
|
|
4867
|
+
class CheckoutSessionsResource {
|
|
4868
|
+
constructor(client) {
|
|
4869
|
+
this.client = client;
|
|
4870
|
+
}
|
|
4871
|
+
/**
|
|
4872
|
+
* Create a new checkout session
|
|
4873
|
+
*
|
|
4874
|
+
* Creates a checkout session with pre-calculated fees and returns
|
|
4875
|
+
* payment URLs for processing the payment.
|
|
4876
|
+
*
|
|
4877
|
+
* Requires Client-Id header to be set in the configuration.
|
|
4878
|
+
*
|
|
4879
|
+
* @param data - Order data for the checkout session (same as order creation)
|
|
4880
|
+
* @returns The created checkout session with payment URLs and fee breakdown
|
|
4881
|
+
*
|
|
4882
|
+
* @example
|
|
4883
|
+
* ```typescript
|
|
4884
|
+
* const session = await sdk.checkoutSessions.create({
|
|
4885
|
+
* reference_id: 'order-123',
|
|
4886
|
+
* total: 100.00,
|
|
4887
|
+
* kind: 'online',
|
|
4888
|
+
* currency_code: 'JMD',
|
|
4889
|
+
* customer: {
|
|
4890
|
+
* email: 'customer@example.com',
|
|
4891
|
+
* first_name: 'John',
|
|
4892
|
+
* last_name: 'Doe',
|
|
4893
|
+
* phone: '+1234567890'
|
|
4894
|
+
* },
|
|
4895
|
+
* title: 'My Order'
|
|
4896
|
+
* });
|
|
4897
|
+
*
|
|
4898
|
+
* // Redirect customer to payment URL
|
|
4899
|
+
* console.log(session.result.payment_url);
|
|
4900
|
+
* ```
|
|
4901
|
+
*/
|
|
4902
|
+
async create(data) {
|
|
4903
|
+
return this.client.post('/checkout/sessions', data);
|
|
4904
|
+
}
|
|
4905
|
+
/**
|
|
4906
|
+
* Get checkout session details by session ID
|
|
4907
|
+
*
|
|
4908
|
+
* Retrieves the current state of a checkout session including
|
|
4909
|
+
* payment status, customer info, and fee breakdown.
|
|
4910
|
+
*
|
|
4911
|
+
* Requires Client-Id header to be set in the configuration.
|
|
4912
|
+
*
|
|
4913
|
+
* @param sessionId - The session ID (e.g., 'S.75a29ad32e52')
|
|
4914
|
+
* @returns The checkout session details
|
|
4915
|
+
*
|
|
4916
|
+
* @example
|
|
4917
|
+
* ```typescript
|
|
4918
|
+
* const session = await sdk.checkoutSessions.get('S.75a29ad32e52');
|
|
4919
|
+
* console.log(session.result.status); // 'awaiting_payment'
|
|
4920
|
+
* ```
|
|
4921
|
+
*/
|
|
4922
|
+
async get(sessionId) {
|
|
4923
|
+
return this.client.get(`/checkout/sessions/${sessionId}`);
|
|
4924
|
+
}
|
|
4925
|
+
/**
|
|
4926
|
+
* Delete (cancel) a checkout session
|
|
4927
|
+
*
|
|
4928
|
+
* Cancels an active checkout session. Once cancelled, the session
|
|
4929
|
+
* can no longer be used for payment.
|
|
4930
|
+
*
|
|
4931
|
+
* Requires Client-Id header to be set in the configuration.
|
|
4932
|
+
*
|
|
4933
|
+
* @param sessionId - The session ID to cancel (e.g., 'S.75a29ad32e52')
|
|
4934
|
+
* @returns Confirmation of the cancellation
|
|
4935
|
+
*
|
|
4936
|
+
* @example
|
|
4937
|
+
* ```typescript
|
|
4938
|
+
* const result = await sdk.checkoutSessions.delete('S.75a29ad32e52');
|
|
4939
|
+
* console.log(result.result); // 'Session cancelled'
|
|
4940
|
+
* ```
|
|
4941
|
+
*/
|
|
4942
|
+
async delete(sessionId) {
|
|
4943
|
+
return this.client.delete(`/checkout/sessions/${sessionId}`);
|
|
4944
|
+
}
|
|
4945
|
+
}
|
|
4946
|
+
|
|
4855
4947
|
/**
|
|
4856
4948
|
* Main Inkress Commerce API SDK class
|
|
4857
4949
|
*
|
|
@@ -4920,6 +5012,7 @@ class InkressSDK {
|
|
|
4920
5012
|
this.paymentMethods = new PaymentMethodsResource(this.client);
|
|
4921
5013
|
this.transactionEntries = new TransactionEntriesResource(this.client);
|
|
4922
5014
|
this.generics = new GenericsResource(this.client);
|
|
5015
|
+
this.checkoutSessions = new CheckoutSessionsResource(this.client);
|
|
4923
5016
|
}
|
|
4924
5017
|
/**
|
|
4925
5018
|
* Update the SDK configuration
|