1.0.7 • Published 7 days ago
@idonatedev/idonate-sdk v1.0.7
What's this?
Javascript libraries for integrating with iDonate services.
Example: Low Level Transaction API, with reCAPTCHA
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>createTransaction demo, with reCaptcha</title>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script src="https://unpkg.com/@idonatedev/idonate-sdk@0.0.4-alpha.1"></script>
</head>
<body>
<button type="button" onclick="grecaptcha.execute()">Submit</button>
<!--
This reCAPTCHA site key will never report a bot user:
https://developers.google.com/recaptcha/docs/faq#id-like-to-run-automated-tests-with-recaptcha.-what-should-i-do
Replace this with your own site key. The corresponding private key must also be configured on your Organization in
the environment you are targeting.
-->
<div
class="g-recaptcha"
data-sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"
data-callback="recaptchaCallback"
data-size="invisible"
></div>
</body>
<script>
// config will usually be supplied statically, at the page level.
config = {
organizationId: '2aa2e362-51aa-483d-bedd-645ae18cc1f3',
paymentGatewayId: '12344321-e605-429e-b9a9-4516738635db',
};
// the rest of this information will typically be entered into forms by donors,
// but is abstracted here for demo purposes.
const billingContact = {
firstName: 'Billing',
lastName: 'Contact',
email: 'billing.contact@example.com',
};
const billingAddress = {
address1: '123 Place St.',
city: 'Hometown',
state: 'TX',
zip: '76543',
country: 'US',
};
const paymentDetails = {
bankRoutingNumber: '123456',
bankAccountNumber: '123456789',
};
idonateClient = new idonate.Client(config.organizationId, {
enableSandboxMode: true,
});
function recaptchaCallback(recaptchaToken) {
/**
* Everything happens after the reCaptcha callback:
* - tokenize payment details with the payment service
* - associate that token with a PaymentMethod within iDonate
* - use the new PaymentMethod to charge a payment and create a new Transaction
*
* createPaymentMethod and createTransaction are both secured using reCaptcha.
*
* A reCaptcha result is valid for two minutes, the same result can be used in both calls as long as the result
* remains valid.
*/
idonateClient
.tokenizeCardConnectBankAccount(
paymentDetails.bankRoutingNumber,
paymentDetails.bankAccountNumber
)
.then((tokenResult) => {
console.log('received tokenResult', tokenResult);
return idonateClient.createPaymentMethod({
paymentGatewayId: config.paymentGatewayId,
paymentMethodType: 'bank_account',
paymentMethodToken: tokenResult.token,
recaptchaToken: recaptchaToken,
contact: billingContact,
address: billingAddress
});
})
.then((paymentMethodResult) => {
console.log('received paymentMethodResult: ', paymentMethodResult);
return idonateClient.createTransaction({
paymentGatewayId: config.paymentGatewayId,
paymentMethodId: paymentMethodResult.paymentMethodId,
recurringFrequency: 'once',
paymentAmount: 5.0,
currency: 'USD',
billingContact: billingContact,
billingAddress: billingAddress,
customerMeta: {
'up to 80 chars': 'up to 800 chars',
is_demo: true,
},
recaptchaToken: recaptchaToken,
corporateMatchingId: -1
});
})
.then((createTransactionResult) => {
console.log(
'received createTransactionResult: ',
createTransactionResult
);
});
}
</script>
</html>
Changes
0.0.4-alpha.3
- adjustments to support internal applications
0.0.4-alpha.1
- rename
idonate.client
toidonate.Client
to fit style guidelinesidonate.client
compatibility will be maintained until 0.0.6 (or equivalent) is released.
- Implement support for (and default to) using the Production environment for API calls.
- Add an
options
parameter to the Client constructor, initially with only one option:enableSandboxMode
- if
enableSandboxMode
is true, API calls will be made against the Staging environment.
- if
- Add
corporateMatchingId
to thecreateTransaction
payload. - Enable support for 'bring-your-own reCAPTCHA', adding the
recaptchaToken
parameter tocreatePaymentMethod
andcreateTransaction
methods.- reCAPTCHA results are valid for two minutes and the same token can be re-used within this timeframe.
- Update example in README to include reCAPTCHA support, trigger with a button instead of on load (example results continue to only show in the console)
0.0.3-alpha.3
- adjust README.
0.0.3-alpha.2
- start really writing this README
- remove organizationId from createTransaction method (determine from client)
- pass customerMeta to backend
- map transactionId in CreateTransactionResult
- Add CardConnect ACH tokenization helper, update demos with ACH features.
1.0.5-dev4
7 days ago
1.0.8
7 days ago
1.0.8-dev
7 days ago
1.0.7-dev
7 days ago
1.0.7
12 days ago
1.0.6
2 months ago
1.0.5-dev3
2 years ago
1.0.5-dev2
2 years ago
1.0.5-dev1
2 years ago
1.0.4
2 years ago
1.0.5-dev0
2 years ago
1.0.3
2 years ago
1.0.3-dev2
2 years ago
1.0.3-dev3
2 years ago
1.0.3-dev1
2 years ago
1.0.2
2 years ago
1.0.1
3 years ago
1.0.1-alpha.3
3 years ago
1.0.1-alpha.2
3 years ago
1.0.1-alpha.1
3 years ago
1.0.0
3 years ago
0.0.5-alpha.14
3 years ago
0.0.5-alpha.13
3 years ago
0.0.5-alpha.12
3 years ago
0.0.5-alpha.11
3 years ago
0.0.5-alpha.10
3 years ago
0.0.5-alpha.9
3 years ago
0.0.5-alpha.8
3 years ago
0.0.5-alpha.7
3 years ago
0.0.5-alpha.6
3 years ago
0.0.5-alpha.4
4 years ago
0.0.5-alpha.5
4 years ago
0.0.5-beta.1
4 years ago
0.0.5-beta.0
4 years ago
0.0.5-alpha.2
4 years ago
0.0.5-alpha.3
4 years ago
0.0.4-alpha.13
4 years ago
0.0.5-alpha.1
4 years ago
0.0.4-alpha.11
4 years ago
0.0.4-alpha.12
4 years ago
0.0.4-alpha.10
4 years ago
0.0.4-alpha.9
4 years ago
0.0.5-alpha.0
4 years ago
0.0.4-alpha.8
4 years ago
0.0.4-alpha.7
4 years ago
0.0.4-alpha.6
4 years ago
0.0.4-alpha.5
4 years ago
0.0.4-alpha.4
4 years ago
0.0.4-alpha.2
4 years ago
0.0.4-alpha.3
4 years ago
0.0.4-alpha.1
4 years ago
0.0.3-alpha.3
4 years ago
0.0.3-alpha.2
4 years ago
0.0.3-alpha.1
4 years ago
0.0.3-alpha.0
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago
0.0.0
4 years ago