aci
v999999999999999.999999999999999.999999999999999
Published
ACI Universal Payments (server-to-server) SDK.
Downloads
16
Readme
ACI
ACI Universal Payments (server-to-server) SDK.
Usage
Aci SDK is using Flow type annotations and JSON schemas to guide/ enforce the shape of the request and response.
import Aci from 'aci';
import type {
AuthenticationType,
PaymentType
} from 'aci';
const apiUrl = 'https://test.oppwa.com/v1/';
/**
* The test credentials are taken from https://docs.aciworldwide.com/tutorials/server-to-server.
*/
const authentication: AuthenticationType = {
entityId: '8a829418571dad0401571e262e320b32',
password: 'TPs5pfgH8e',
userId: '8a829418571dad0401571e262ef80b36'
};
const client = new Aci(apiUrl, authentication);
const paymentPayload: PaymentType = {
amount: '1.00',
card: {
cvv: '123',
expiryMonth: '05',
expiryYear: '2020',
holder: 'Jane Jones',
number: '4200000000000000'
},
currency: 'GBP',
paymentBrand: 'VISA',
paymentType: 'PA'
};
const paResponse = await client.createPayment(paymentPayload);
Handling errors
- A malformed request results in a
MalformedRequestError
error. - A response with a result code other than success results in a
AciRemoteError
error.