Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Amazon Pay Sdk Php | 205 | 74 | 8 | 10 months ago | 17 | March 23, 2021 | 35 | apache-2.0 | PHP | |
Amazon Pay PHP SDK | ||||||||||
Amazon Payments Magento 2 Plugin | 93 | 11 hours ago | 106 | August 24, 2022 | 6 | apache-2.0 | PHP | |||
Extension to enable Amazon Pay on Magento 2 | ||||||||||
Amazon Pay Sdk Ruby | 55 | 1 | 2 years ago | 11 | March 23, 2021 | 6 | apache-2.0 | Ruby | ||
Amazon Pay Ruby SDK | ||||||||||
Amazon Pay Sdk Java | 54 | 9 months ago | 13 | apache-2.0 | Java | |||||
Amazon Pay Java SDK | ||||||||||
Amazon Pay Sdk Csharp | 45 | 3 | 8 months ago | 25 | March 23, 2021 | 12 | apache-2.0 | C# | ||
Amazon Pay C# SDK | ||||||||||
Amazon Pay Sdk Python | 43 | 2 years ago | 6 | March 26, 2021 | 7 | apache-2.0 | Python | |||
Amazon Pay Python SDK | ||||||||||
Simplepay | 37 | 13 years ago | Ruby | |||||||
Ruby gem for integration with Amazon Simple Pay | ||||||||||
Amazon Pay Api Sdk Php | 35 | 2 | 13 days ago | 12 | February 07, 2022 | 14 | apache-2.0 | PHP | ||
Amazon Pay API SDK (PHP) | ||||||||||
Amazon Pay Sdk Samples | 32 | 3 years ago | 6 | apache-2.0 | PHP | |||||
Amazon Pay SDK Sample Code | ||||||||||
Amazon Pay Api Sdk Nodejs | 29 | 14 days ago | 2 | apache-2.0 | JavaScript | |||||
Amazon Pay API SDK (Node.js) |
Un-official implementation of Amazon pay in React.
yarn add amazon-pay-react
npm install amazon-pay-react
For using all widgets on a single page importing AmazonPay
should be enough:
import AmazonPay from 'amazon-pay-react';
<AmazonPay
clientId='your-cliendId'
sellerId='your-sellerId'
agreementType={'BillingAgreement'}
scope='profile payments:widget'
btnType='PwA'
btnColor='Gold'
btnSize='medium'
onConsentChange={(hasConsent) => ...handle}
handleBillingAgreementId={(billingAgreementId) => ...handle}
billingAgreementId={this.state.billingAgreementId}
useAmazonAddressBook={true}
/>
Additional options to AmazonPay component:
Attribute | Description | Type |
---|---|---|
isSandbox | Sandbox or production env | boolean |
region | Defines region, default 'us' (you can use REGION constant) | string |
onAmazonLoginReady | Function callback | function |
onAddressSelect | Function callback | function |
onPaymentSelect | Function callback | function |
onOrderReferenceCreate | Function callback | function |
handleAddressBookError | Function callback | function |
handleWalletOnPaymentSelect | Function callback, argument orderReference | function |
handleWalletError | Function callback | function |
handleConsentError | Function callback | function |
handleButtonError: | Function callback | function |
When you want to have component per view, you must wrap each widget/component individually with the following wrapper in order to not try and render without having the script previously loaded.
import {AmazonPayButton, amazonBootstrapComponent} from 'amazon-pay-react';
const BootstrappedAmazonPayButton = amazonBootstrapComponent(AmazonPayButton);
Note that BootstrappedAmazonPayButton
version will require additional attributes:
Attribute | Description | Type |
---|---|---|
isSandbox | Sandbox or production env | boolean |
region | Defines region, default 'us' (you can use REGION constant) | string |
amazonScriptLoaded | True if amazon library has loaded via onAmazonLoginReady | boolean |
onAmazonLoginReady | Function callback | function |
Check this example implementation for a quick start.
AmazonPayButton
AmazonPayButton.propTypes = {
sellerId: PropTypes.string.isRequired,
scope: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
color: PropTypes.string.isRequired,
size: PropTypes.string.isRequired,
useAmazonAddressBook: PropTypes.bool.isRequired,
onAuthorization: PropTypes.func.isRequired, // When user authorizes, callback with response object
onError: PropTypes.func, // callback err object
};
onAuthorization response object:
{
"status": "complete",
"access_token": "your-token",
"token_type": "bearer",
"expires_in": 3226,
"scope": "profile payments:widget"
}
AmazonAddressBook
AmazonAddressBook.propTypes = {
sellerId: PropTypes.string.isRequired,
agreementType: PropTypes.string.isRequired,
style: PropTypes.object,
onReady: PropTypes.func, // Callback that provides orderReference
onError: PropTypes.func, // Callback that provides err object
onAddressSelect: PropTypes.func, // Callback that provides orderReference
onOrderReferenceCreate: PropTypes.func, // Callback that provides orderReference
};
Error object usage: console.log(err.getErrorCode() + ': ' + err.getErrorMessage());
Order reference usage: orderReference.getAmazonOrderReferenceId();
Consent Widget
ConsentWidget.propTypes = {
amazonBillingAgreementId: PropTypes.string.isRequired,
sellerId: PropTypes.string.isRequired,
style: PropTypes.object,
onReady: PropTypes.func, // First load callback that provides hasConsent (true|false)
onConsent: PropTypes.func, // On consent change, callback that provides hasConsent status
onError: PropTypes.func, // Callback that provides error object
};
If you want to contribute to the library feel free to create an issue and/or a PR with a prefix of feature/your-feature-name or bugfix/your-bug-name
yarn dev
yarn test
Note that you can swap between single page and React router version at examples/src/index.js
If you want to quick test library implementation locally you can use yarn link
.
Just don't forget to build it before that with yarn build
.