The best Stripe library for React Native.
$ npm i react-native-stripe-api --save
or
$ yarn add react-native-stripe-api
- include a payment form component
- include react-native-awesome-card-io
https://github.com/xcarpentier/react-native-stripe-api/issues/8
This lib need a Stripe API Key
const apiKey = '<your Stripe API Key>';
const client = new Stripe(apiKey);
// Create a Stripe token with new card infos
const token = await client.createToken('4242424242424242' , '09', '18', '111');
// Create a new customer and link your new card
const customer = await client.createCustomer(token.id, 'customer@email.com', '<Your user ID>', 'John', 'Doe');
// Create charge, 1 USD
const charge = await client.createCharge(1 * 100, customer.id, 'Payment example','USD');
Name | Return Type | Arguments | Description |
---|---|---|---|
createToken | Promise |
|
Create a new token (equivalent of a new card) |
createCustomer | Promise |
|
Create a new customer and add card (or token) |
getCustomer | Promise | customerId: string | Retrieve customer by its id |
createCharge | Promise |
|
Create a new charge |
refundCharge | Promise | chargeId: string | Refund a previous charge |
addCardToCustomer | Promise |
|
Add a new card to a customer |
destroyCardOfCustomer | Promise |
|
Delete a card from a customer |
> Android 4.4
see https://github.com/xcarpentier/react-native-stripe-api/issues/5
-
@xcapentier The main author.
PRs are welcome !
Feel free to contact me or create an issue
made with ♥