Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from remedyproduct/development
Browse files Browse the repository at this point in the history
Add new method
  • Loading branch information
vad9s6 authored Nov 9, 2021
2 parents 1f5f79f + 75b9cda commit 4e58668
Show file tree
Hide file tree
Showing 14 changed files with 316 additions and 157 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and deploy
name: Build and test
on:
push:
branches:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### v0.0.4

- Added method `getAllCards`
- Added method `getCustomer`
- Added method `setDefaultCard`
- Updated docs

### v0.0.3

- Added method `addSourceToCustomer`
Expand Down
52 changes: 47 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,53 @@ const stripe = await loadStripe("pk_test_TYooMQauvdEDq54NiTphI7jx");

## Additional Methods

| Method | Arguments | Description | Example |
| -------------------------- | ------------------------------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| confirmPaymentIntentByCard | [client_secret], [card_id] | Confirm payment with the user's payment intent card. | `stripe.confirmPaymentIntentByCard('pi_3Jrk80HdlMaZle3e1tGtSxiH_secret_mWdWNlqJfkYEoYOml1GqRPyPm', 'card_1JrMi8HdlMaZle3eSPPOvapJ')` |
| addSourceToCustomer | [source or token], [customer_id], [ephemeral_key] | Add payment method to customer (from source or token). | `stripe.addSourceToCustomer('tok_visa', 'cus_KO9SkBdMeHoMXR', 'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ')` |
| deleteSourceFromCustomer | [source_id], [customer_id], [ephemeral_key] | Delete payment method from customer. | `stripe.deleteSourceFromCustomer('card_1JroRSHdlMaZle3e4EIGOZuv', 'cus_KO9SkBdMeHoMXR', 'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ')` |
| Method | Arguments | Description |
| -------------------------- | ------------------------------------------------- | ------------------------------------------------------ |
| confirmPaymentIntentByCard | [client_secret], [card_id] | Confirm payment with the user's payment intent card. |
| addSourceToCustomer | [source or token], [customer_id], [ephemeral_key] | Add payment method to customer (from source or token). |
| deleteSourceFromCustomer | [source_id], [customer_id], [ephemeral_key] | Delete payment method from customer. |
| getAllCards | [ephemeral_key], [customer_id] | Get all cards from customer. |
| getCustomer | [ephemeral_key], [customer_id] | Get customer.
|
| setDefaultCard | [defaultCardId], [ephemeral_key], [customer_id] | Set default card.
|

## Examples

```
stripe.confirmPaymentIntentByCard(
'pi_3Jrk80HdlMaZle3e1tGtSxiH_secret_mWdWNlqJfkYEoYOml1GqRPyPm',
'card_1JrMi8HdlMaZle3eSPPOvapJ'
);
stripe.addSourceToCustomer(
'tok_visa',
'cus_KO9SkBdMeHoMXR',
'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);
stripe.deleteSourceFromCustomer(
'card_1JroRSHdlMaZle3e4EIGOZuv',
'cus_KO9SkBdMeHoMXR',
'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);
stripe.getAllCards(
'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ',
'cus_KO9SkBdMeHoMXR'
);
stripe.getCustomer(
'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ',
'cus_KO9SkBdMeHoMXR'
);
stripe.setDefaultCard(
'card_1JrMi8HdlMaZle3eSPPOvapJ',
'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ',
'cus_KO9SkBdMeHoMXR'
);
```

## Scripts

Expand Down
Loading

0 comments on commit 4e58668

Please sign in to comment.