NAV
Purchase
version 4
PHP Java

YoursafeDirect purchase

Create new purchase

Example for Verotel FlexPay PHP client library:

$flexpayClient = new Verotel\FlexPay\Client(
    685478,                   // shop ID / website ID
    "d6dToIj2d6YJ1PX2D1W9"    // FlexPay signatureKey
    new Verotel\FlexPay\YoursafeDirect()
);

$purchaseUrl = $flexpayClient->get_purchase_URL([
    "priceAmount"   => 14.00,
    "priceCurrency" => "EUR",
    "description"   => "Purchase of foo",
    "paymentMethod" => "IDEAL",
    "email"         => "example@example.com",
    "declineURL"    => "http://example.com/declined",
    "successURL"    => "http://example.com/success"
]);

Create new purchase

Example for Verotel FlexPay Java client library:

FlexPayClient flexPayClient = new FlexPayClient(
    685478,                 // shop ID / website ID
    "d6dToIj2d6YJ1PX2D1W9", // FlexPay signatureKey
    Brand.YOURSAFE_DIRECT
);

URL purchaseUrl = flexPayClient.purchaseBuilder()
    .withAmount(BigDecimal.valueOf(14), SaleCurrency.EUR)
    .withDescription("Purchase of foo")
    .withPaymentMethod(PaymentMethod.IDEAL)
    .withEmail("example@example.com")
    .withDeclineURL("http://example.com/declined")
    .withSuccessURL("http://example.com/back")
    .build();

FlexPay purchase initiates payment and redirects the buyer to the iDEAL payment page.

HTTP request

GET https://secure.yoursafedirect.com/status/order?

Query parameters

Parameter Type Required Description
version Number mandatory version of the FlexPay call, 4 for this version
shopID Number mandatory numerical ID of the website in the Verotel system
type String mandatory purchase must be set
priceAmount Number mandatory amount to be processed in nnn.nn format
priceCurrency String mandatory 3 char ISO code, must be one of the Sale currencies (USD EUR GBP AUD CAD CHF DKK NOK SEK), depending on your account setup
description String mandatory description of the product. Text is displayed on the iDEAL payment page - max 100 printable characters
paymentMethod String mandatory IDEAL must be set.
referenceID String optional merchant's reference identifier. It must be unique if provided
custom1 String optional pass-through variable - max 255 printable characters. Is returned in postbacks
custom2 String optional pass-through variable - max 255 printable characters. Is returned in postbacks
custom3 String optional pass-through variable - max 255 printable characters. Is returned in postbacks
successURL String conditional URL for redirect after successful transaction - max 255 characters. Can be omitted if default success landing URL is set on the website.
declineURL String conditional URL for redirect after declined transaction - max 255 characters. Can be omitted if default decline landing URL is set on the website.
email String mandatory email of the buyer. NOTE: email is excluded from signature calculations (max 100 chars else it will be ignored)
signature String mandatory Signature calculation

Success postback

Verify postback data

Example for Verotel FlexPay PHP client library

// pass GET params received in postback
$paramsAreVerified = $flexPayClient->validate_signature([...]);

Verify postback data

Example for Verotel FlexPay Java client library

// pass GET params received in postback
Boolean paramsAreVerified = flexPayClient.validateSignature(Map.of(...));

The successful sale postback is sent to the "Postback URL" immediately after the sale has been processed. The postback is sent only for successfully approved transactions. The data in the postback provide essential information about the sale. If more information is needed, the merchant should query the status page.

Important: The Verotel system expects HTTP status code 200 and plain text "OK" response. The response must be returned within 30 seconds.

Parameter Type Description
shopID Number numerical ID of the website in the Verotel system
type String purchase
referenceID String merchant reference identifier. It must be unique if provided
saleID Number identifier of the sale in the Verotel system
transactionID Number identifier of the transaction in the Verotel system
priceAmount Number amount to be processed in nnn.nn format
priceCurrency String 3 char ISO code of the Sale currency
custom1 String pass-through variable - max 255 printable characters
custom2 String pass-through variable - max 255 printable characters
custom3 String pass-through variable - max 255 printable characters
paymentMethod String payment method, IDEAL
signature String Signature calculation

Status page request

Query sale status

Example for Verotel FlexPay PHP client library

$statusURL = $flexPayClient->get_status_URL(['saleID' => 123456]);

Query sale status

Example for Verotel FlexPay Java client library

URL statusUrl = flexPayClient.getStatusUrlBySale(123456);

The status of a sale made with a FlexPay API can be reviewed by querying the status page. Status page provides complete information in - YAML format - about the sale, the buyer, and its status.

HTTP request

GET https://secure.yoursafedirect.com/status/order?

Query parameters

Parameter Type Description
version Number 4
shopID Number numerical ID of the website in the Verotel system
referenceID String Merchant's reference identifier if provided (referenceID OR saleID must be posted - NOT BOTH)
saleID Number Verotel saleID identifier (referenceID OR saleID must be posted - NOT BOTH)
signature String Signature calculation

Response

Parameter Description
response FOUND - purchase record found and returned
NOTFOUND - purchase not found
ERROR - error (see 'error' key)
error message (for response=ERROR)
saleID identifier of the transaction in Verotel System
shopID ID of website in Verotel system
paymentMethod an identifier of payment method that was used for the transaction.
priceAmount amount processed. in nnn.nn formatt
priceCurrency 3 char ISO code of the Sale currency
description Product description text - max 100 printable characters
referenceID Merchant reference identifier - max 100 printable characters
name name of the buyer
email email address of the buyer
country selected or detected country ISO code (ISO 3166-1-alpha-2 code)
createdOn Timestamp of purchase creation
saleResult purchase processing result (APPROVED)

Signature calculation

Calculate signature

Example for Verotel FlexPay PHP client library

$computed_signature = $flexpayClient->get_signature([
    'description' => 'Super video download',
    'priceAmount' => '9.99',
    'priceCurrency' => 'USD',
    'shopID' => 12345,
    'version' => 4,
]);

Calculate signature

Example for Verotel FlexPay Java client library

String computedSignature = flexpayClient.getSignature(Map.of(
    "description", "Super video download",
    "priceAmount", "9.99",
    "priceCurrency", "USD",
    "shopID", 12345,
    "version", 4
));

If you are using one of our client libraries, signature calculation is handled by the library.

The signature used in FlexPay requests and postbacks is calculated as SHA-256 hash (hexadecimal output) from the request parameters.

The first parameter has to be your signatureKey, followed by the parameters ordered alphabetically by their names.

Optional arguments that are used (have value) must be contained in the signature calculation. Optional arguments that are not used must not be contained in the signature calculation.

The email parameter in "startorder" request is not included in the signature calculations.

It is mandatory to convert arguments values into UTF-8 before computing the signature.

e.g.

signature = sha256_hex( signatureKey + ":description=" + description + ":period=" + period + ":priceAmount=" + priceAmount + ":priceCurrency=" + priceCurrency + ":referenceID=" + referenceID + ":shopID=" + shopID + ":subscriptionType=" + subscriptionType + ":type=" + type + ":version=" + version )

Example calculation

Parameter Value
(signatureKey) BddJxtUBkDgFB9kj7Zwguxde4gAqha
description Super video download
priceAmount 9.99
priceCurrency USD
custom1 xxyyzz
shopID 64233
type purchase
version 4

Signature calculation using the values above

signature = sha256_hex(BddJxtUBkDgFB9kj7Zwguxde4gAqha:custom1=xxyyzz:description=Super video download:priceAmount=9.99:priceCurrency=USD:shopID=64233:type=purchase:version=4) => ccaf2357fe330654322a1b0f3f92984b3fe2a1462d6fc5082650a00c5ada2f2a

The FlexPay purchase request then is

https://secure.verotel.com/startorder?custom1=xxyyzz&description=Super+video+download&priceAmount=9.99&priceCurrency=USD&shopID=64233&type=purchase&version=4&signature=ccaf2357fe330654322a1b0f3f92984b3fe2a1462d6fc5082650a00c5ada2f2a