Sample-localmarkeplace

From Barion Documentation
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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. Read more about C2C Payments and review transaction and API mappings.

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,
            PayeeTransactions: [
                {
                    POSTransactionId: "TR-01-02-01",
                    Payee: "[email protected]",
                    Total: 3,
                    Comment: "Marketplace commission: TR-01-02-01."
                },
                {
                    POSTransactionId: "TR-01-02-02",
                    Payee: "[email protected]",
                    Total: 3,
                    Comment: "Local agent commission: TR-01-02-02."
                },     
            ],
            Items: [
                {
                    Name: "Old Amsterdam",
                    Description: "Hard cheese from the Netherlands",
                    Quantity: 2,
                    Unit: "pcs",
                    UnitPrice: 10,
                    ItemTotal: 20,
                    SKU: ""
                },
                {
                    Name: "Edam",
                    Description: "Soft cheese from the Netherlands",
                    Quantity: 1,
                    Unit: "pcs",
                    UnitPrice: 10,
                    ItemTotal: 10,
                    SKU: ""
                },
            ]
        }

    ]
}

More Code Samples