Sample-localmarkeplace

From Barion Documentation
Revision as of 20:49, 4 September 2017 by Birot (talk | contribs)
Jump to navigation Jump to search

Local producers' marketplace - C2C sample

This example is the input of v2 /Payment/Start API call for an online marketplace, where customers can shop groceries from several local producers, delivered to a local marketplace managed by a local agent. The agent and the marketplace both receive a 10% commission from each farmer. The API call is initiated by the marketplace, as the facilitator.

API Input JSON

{
    POSKey: "999FFDDA-04FF-333F-CCCC-345FCB555FFC",
    PaymentType: "Immediate",             
    PaymentWindow: "00:30:00",
    PaymentRequestId: "fa-01",
    PayerHint: "[email protected]",
    Locale: "en-US",
    Currency: "EUR",
    FundingSources: [
        "All"
    ],
    Transactions: [
        {
            POSTransactionId: "fa-01-01",
            Payee: "[email protected]",
            Total: 20,
            //Immediately after crediting €20 to [email protected], €2 will be sent to the marketplace and €2 will be sent to the local agent.
            PayeeTransactions: [
                {
                    POSTransactionId: "TR-01-01-01",
                    Payee: "[email protected]",
                    Total: 2,
                    Comment: "Marketplace commission: TR-01-01-01."
                },
                {
                    POSTransactionId: "TR-01-01-02",
                    Payee: "[email protected]",
                    Total: 2,
                    Comment: "Local agent commission: TR-01-01-02."
                },     
            ],
            Items: [
                {
                    Name: "Carrots",
                    Description: "Organic carrots",
                    Quantity: 2,
                    Unit: "kg",
                    UnitPrice: 2,
                    ItemTotal: 4,
                    SKU: ""
                },
                {
                    Name: "Cabbages",
                    Description: "Cabbages",
                    Quantity: 2,
                    Unit: "kg",
                    UnitPrice: 2,
                    ItemTotal: 4,
                    SKU: ""
                },
                {
                    Name: "Artichokes",
                    Description: "Organic artichokes",
                    Quantity: 6,
                    Unit: "pcs",
                    UnitPrice: 2,
                    ItemTotal: 12,
                    SKU: ""
                },
            ]
        },
        {
            POSTransactionId: "fa-01-02",
            Payee: "[email protected]",
            Total: 30,
            //Immediately after crediting €30 to [email protected], €3 will be sent to the marketplace.
            PayeeTransactions: [
                {
                    POSTransactionId: "TR-01-02-01",
                    Payee: "[email protected]",
                    Total: 30,
                    Comment: "Marketplace commission: TR-01-02-01."
                },
            ],
            Items: [
                {
                    Name: "Necklace",
                    Description: "Hand made copper necklace with glass decor",
                    Quantity: 1,
                    Unit: "db",
                    UnitPrice: 30,
                    ItemTotal: 30,
                    SKU: ""
                },
            ]
        }

    ]
}

More Code Samples