If you're using , you can create a payment method for your app or website in four easy steps:
Step 1: Build a PayCo Source Request and Details object
Build the PayCo Source Request and Details objects. The PayCo Source Request object requires the following fields.
Field
Value
type
payco
sessionId
The payment session identifier.
owner
payco
PayCo Source Details object
The PayCo Source Details object requires the following fields.
{
"returnUrl": "https://example.com"
}
Field
Required/Optional
Description
returnUrl
Required
If you choose to use the full redirect flow, this is where you will redirect your customer to after authorizing or canceling within the PayCo experience.
Step 2: Create a PayCo source using DigitalRiver.js
Use the DigitalRiver.js library to create and mount elements to the HTML container.
var data = {
"type": "payco",
"sessionId": "ea03bf6f-84ef-4993-b1e7-b7d5ecf71d1f",
"owner": {
firstName: "John",
lastName: "Doe",
email: "test@digitalriver.com",
address: {
line1: "1234 Fake Street",
line2: "Yaum-dong",
city: "Ulsan-si",
state: "Kyongsangnamdo",
postalCode: "100-011",
country: "KR"
}
},
"payco": {
"returnUrl": "https://yourReturnUrl.com"
}
}
digitalriver.createSource(data).then(function(result) {
if (result.error) {
//handle errors
} else {
var source = result.source;
//send source to back end
sendToBackend(source);
}
});
When you create a Direct Debit source, the customer must authorize the charge through their payment provider. You can accomplish this by redirecting the customer to their payment provider.
Redirecting the customer for PayCo authorization
Use the redirectUrl parameter in your createSource response to redirect your customer to the payment provider for authorization.
The payment provider will present the customer with the transaction details where they can authorize, or cancel the transaction. A successful authorization redirects the customer to the Payco Return URL parameter you specified when you created the source.
Once authorized, the source state will change to chargeable.