Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CardField types for Fullstack Subscription #593

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wild-icons-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@paypal/paypal-js": patch
---

Update CardField types for Fullstack Subscription
16 changes: 15 additions & 1 deletion packages/paypal-js/types/components/card-fields.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export interface PayPalCardFieldsStyleOptions {

export type CardFieldsOnApproveData = {
orderID: string;
/**
* subscriptionID is newly added for Fullstack Subscription.
* @alpha
*/
subscriptionID?: string;
};

export interface PayPalCardFieldsInputEvents {
Expand Down Expand Up @@ -139,17 +144,26 @@ export interface PayPalCardFieldsComponentCreateOrder
extends PayPalCardFieldsComponentBasics {
createOrder: () => Promise<string>;
createVaultSetupToken?: never;
createSubscription?: never;
}

export interface PayPalCardFieldsComponentCreateVaultSetupToken
extends PayPalCardFieldsComponentBasics {
createOrder?: never;
createVaultSetupToken: () => Promise<string>;
createSubscription?: never;
}
export interface PayPalCardFieldsComponentCreateSubscription
extends PayPalCardFieldsComponentBasics {
createOrder?: never;
createVaultSetupToken?: never;
createSubscription: () => Promise<string>;
}

export type PayPalCardFieldsComponentOptions =
| PayPalCardFieldsComponentCreateOrder
| PayPalCardFieldsComponentCreateVaultSetupToken;
| PayPalCardFieldsComponentCreateVaultSetupToken
| PayPalCardFieldsComponentCreateSubscription;

export interface PayPalCardFieldsComponent {
getState: () => Promise<PayPalCardFieldsStateObject>;
Expand Down