Sample-oneclickpayment: Difference between revisions

From Barion Documentation
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{PageTitle|title=Electronisc shop - e-shop with one click payment sample}} This example is the input of <span class="api-ver">v2</span> Payment-Start-v2|/Payment...")
 
No edit summary
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:
This example is the input of <span class="api-ver">v2</span> [[Payment-Start-v2|/Payment/Start]] API call for an online shop selling electronics. This is the simplest transaction type where the customer pays to the merchant. There are two versions of the call, an initial, where [[Token_payment|Token payment]] is initiated and user is redirected to the Payment GUI, and a subsequent call where the token is used to make payments from the initial funding source without user interaction.
This example is the input of <span class="api-ver">v2</span> [[Payment-Start-v2|/Payment/Start]] API call for an online shop selling electronics. This is the simplest transaction type where the customer pays to the merchant. There are two versions of the call, an initial, where [[Token_payment|Token payment]] is initiated and user is redirected to the Payment GUI, and a subsequent call where the token is used to make payments from the initial funding source without user interaction.


'''API Input JSON'''
'''API Input JSON for initiating Token payment'''
<source lang="javascript">
<source lang="javascript">
{
{
Line 13: Line 13:
     GuestCheckout : "True",
     GuestCheckout : "True",
     FundingSources: [ "All" ],     
     FundingSources: [ "All" ],     
    InitiateRecurrence : "True", //If set to True, the Token will be recorder
    RecurrenceId : "345986-25646-3456346", //Token provided by merchant for subsequent payments


     PaymentRequestId: "payment-25",
     PaymentRequestId: "payment-25",
Line 51: Line 54:
                 {
                 {
                     Name: "SD Card",
                     Name: "SD Card",
                     Description: "SanDisk SD mini 512GB - 3 year garantee",
                     Description: "SanDisk SD mini 512GB - 3 year guarantee",
                     Quantity: 2,
                     Quantity: 2,
                     Unit: "pcs",
                     Unit: "pcs",
Line 57: Line 60:
                     ItemTotal: 100,
                     ItemTotal: 100,
                     SKU: "snd-sd-500gm"
                     SKU: "snd-sd-500gm"
                }
            ]
        }
    ]
}
</source>
'''API Input JSON for subsequent Token payments'''
<source lang="javascript">
{
    POSKey: "567FFDDA-0775-2343D-4564C-3AAB53453C",
    PaymentType: "Immediate",           
    FundingSources: [ "All" ],   
    InitiateRecurrence : "False", //If set to False, the Token will be used to execute the payment
    RecurrenceId : "345986-25646-3456346", //Token previously recorded
    PaymentRequestId: "payment-26",
    OrderNumber: "order-26",
    PayerHint: "[email protected]",
    ShippingAddress:  {
        Country: "AT",
        City: "Vienna",
        Region: "",
        Zip: "1234",
        Street: "13 Etwas Strasse",
        Street2: "",
        FullName: "Joseph Schmidt",
        Phone: "43259123456789"
    },
    CallbackUrl: "http://shop.example.com/api/callback",
    Locale: "de-AT",
    Currency: "EUR",
   
    Transactions: [
        {
            POSTransactionId: "tr-26",
            Payee: "[email protected]",
            Total: 20,
            Items: [
                {
                    Name: "SD Card",
                    Description: "SanDisk SD mini 64GB - 3 year guarantee",
                    Quantity: 2,
                    Unit: "pcs",
                    UnitPrice: 10,
                    ItemTotal: 20,
                    SKU: "snd-sd-100gm"
                 }
                 }
             ]
             ]

Revision as of 20:38, 4 September 2017

Electronisc shop - e-shop with one click payment sample

This example is the input of v2 /Payment/Start API call for an online shop selling electronics. This is the simplest transaction type where the customer pays to the merchant. There are two versions of the call, an initial, where Token payment is initiated and user is redirected to the Payment GUI, and a subsequent call where the token is used to make payments from the initial funding source without user interaction.

API Input JSON for initiating Token payment

{
    POSKey: "999FFDDA-04FF-333F-CCCC-345FCB555FFC",
    PaymentType: "Immediate",             
    PaymentWindow: "00:30:00",

    GuestCheckout : "True",
    FundingSources: [ "All" ],    

    InitiateRecurrence : "True", //If set to True, the Token will be recorder
    RecurrenceId : "345986-25646-3456346", //Token provided by merchant for subsequent payments

    PaymentRequestId: "payment-25",
    OrderNumber: "order-25",
    PayerHint: "[email protected]",
    ShippingAddress:  {
        Country: "AT",
        City: "Vienna",
        Region: "",
        Zip: "1234",
        Street: "13 Etwas Strasse",
        Street2: "",
        FullName: "Joseph Schmidt",
        Phone: "43259123456789"
    },

    RedirectUrl: "http://shop.example.com/danke-fur-den-kauf",
    CallbackUrl: "http://shop.example.com/api/callback",

    Locale: "de-AT",
    Currency: "EUR",
    
    Transactions: [
        {
            POSTransactionId: "tr-25",
            Payee: "[email protected]",
            Total: 400,
            Items: [
                {
                    Name: "Digital Camera",
                    Description: "Canon D500",
                    Quantity: 1,
                    Unit: "pcs",
                    UnitPrice: 300,
                    ItemTotal: 300,
                    SKU: "cn-d500-fxc3"
                },
                {
                    Name: "SD Card",
                    Description: "SanDisk SD mini 512GB - 3 year guarantee",
                    Quantity: 2,
                    Unit: "pcs",
                    UnitPrice: 50,
                    ItemTotal: 100,
                    SKU: "snd-sd-500gm"
                }
            ]
        }
    ]
}

API Input JSON for subsequent Token payments

{
    POSKey: "567FFDDA-0775-2343D-4564C-3AAB53453C",
    PaymentType: "Immediate",             

    FundingSources: [ "All" ],    

    InitiateRecurrence : "False", //If set to False, the Token will be used to execute the payment
    RecurrenceId : "345986-25646-3456346", //Token previously recorded

    PaymentRequestId: "payment-26",
    OrderNumber: "order-26",
    PayerHint: "[email protected]",
    ShippingAddress:  {
        Country: "AT",
        City: "Vienna",
        Region: "",
        Zip: "1234",
        Street: "13 Etwas Strasse",
        Street2: "",
        FullName: "Joseph Schmidt",
        Phone: "43259123456789"
    },

    CallbackUrl: "http://shop.example.com/api/callback",

    Locale: "de-AT",
    Currency: "EUR",
    
    Transactions: [
        {
            POSTransactionId: "tr-26",
            Payee: "[email protected]",
            Total: 20,
            Items: [
                {
                    Name: "SD Card",
                    Description: "SanDisk SD mini 64GB - 3 year guarantee",
                    Quantity: 2,
                    Unit: "pcs",
                    UnitPrice: 10,
                    ItemTotal: 20,
                    SKU: "snd-sd-100gm"
                }
            ]
        }
    ]
}

More Code Samples