Developer guide

How to generate token, make IPN / callback, Payment_list and capture / refund for your webshop.

What do you seek?

Generate token

The message from Yourpay

Here are your payments

Capture or return payment

1. Generate token

The Generate token is the function used to generate the payment URL. It also means that it is in the generate token that you define all settings that should follow the specific payment.

The information sent to us is transformed into a unique token that only pertains to that particular payment. The currency input variable follows ISO 4217. That is, the currency DKK has the value 208.

You can see a code example below. The code snippet is written in Python. You can find more examples in our API.

        
        $ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://webservice.yourpay.dk/v4.3/generate_token?merchant_token=&MerchantNumber=&ShopPlatform=&amount=¤cy=&accepturl=");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
    

The code is now copied

2. IPN/callback

When the payment is approved, the user is automatically sent to the accepturl you have defined. We now need to notify your order system that your payment has been received by Yourpay, so that you can send the order confirmation to the customer and mark that the order is ready for packing.

Your callback from us contains order number from generate token, amount, card number, payment ID and currency.

Kunden kan ikke se callbackurl’en, og det er derfor en sikker kommunikation mellem dig og os. På den måde sikrer vi, at du undgår falske ordrer.

Bonusinfo:

When we send the message to your order system, we expect it to match the header status code 200 according to the RFC 7230 standard. In other words, your system receives the message from us without fail.

Should it fail or your server is offline, we try 15 times every 5 minutes. You can see all the callbacks we have tried (including those completed) in Admin.

If the message cannot be delivered within the 15 attempts, we will stop the callback attempts, but the payment will still be available in Admin.

You can see a code example below. The code snippet is written in Python. You can find more examples in our API.

        
            $ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://webservice.yourpay.dk/v4.3/payment_list?merchant_token=&listtype=");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
    

The code is now copied

3. Payment_list

Payment_list is divided into four categories; non-captured, captured, refunded and released payments. You will automatically see all payments for the merchant token you are requesting, as well as any underlying agreements for this merchant token.

If you want to see payments from a single period, it can be defined in the variables you send to us.

If you have test transactions in your account, they can be automatically sorted out by setting the test variable to 1. All payment ID’s can be found in Payment_list.

You can see a code example below. The code snippet is written in Python. You can find more examples in our API.

        
        $ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://webservice.yourpay.dk/v4.3/payment_list?merchant_token=&listtype=");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
    

Code is now copied

4. Capture/refund

In Capture / refund you have the option to capture or refund an amount. When you choose to capture an amount, the number of banking days you selected as payout days will pass before you receive the money.

Partial Capture

You have the option to make a partial capture if a customer, for example has bought two t-shirts and there is only one in stock. You may charge the balance at a later date.

Remember that you may only withdraw money from orders that you have sent. It is your responsibility that the customer receives the order.

Generate token

If the customer does not receive the order and you have captured the payment, the customer can make a legitimate chargeback and you will have to return the money.

Partial Refund

You also have the option of a partial refund of the customer, for example if the customer returns one out of two items. We recommend that you capture the money within 30 days, as we are sure to make a payout during that period.

You can see a code example below. The code snippet is written in Python. You can find more examples in our API.

    
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://webservice.yourpay.dk/v4.3/payment_action?merchant_token=&id=&amount=");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);

$response = curl_exec($ch);
curl_close($ch);

var_dump($response);
    

Code is now copied

Didn't find what you were looking for?