|
|
(22 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
| __NOTOC__ | | __NOTOC__ |
| {{PageTitle|title= Barion technical documentation}} | | {{PageTitle|title= Sample API Calls}} |
| | | {{NotificationBox|title=NOTE|text=We know developers like to hack and start with sample code (we do, too). Please save time by reading the Getting Started section!|color=#1993c7}} |
| Welcome to the technical documentation of the Barion Smart Gateway electronic payment system. In this wiki you can find the resources needed to implement quick and reliable payment services in your web shop or mobile application.
| |
| | |
| ==Before you start coding== | | ==Before you start coding== |
| *[[Getting_started|Getting started - overview of Barion payments]] | | *[[Getting_started|Getting started - overview of Barion payments]] |
| *[[Sandbox|Setting up the Sandbox environment and testing payments]]
| |
| *[[Creating_an_account|Creating an account]]
| |
|
| |
| ==== C2C Online training marketplace ====
| |
| This example is the input of <span class="api-ver">v2</span> [[Payment-Start-v2|/Payment/Start]] API call for an online marketplace, where students pay a fee for online classes to teachers, and the marketplace receives a fee. The API call is initiated by the marketplace, as the facilitator.
| |
|
| |
| '''API Input JSON'''
| |
| <source lang="javascript">
| |
| {
| |
| POSKey: "999FFDDA-04FF-333F-CCCC-345FCB555FFC",
| |
| PaymentType: "Immediate",
| |
| PaymentWindow: "00:30:00",
| |
| PaymentRequestId: "fa-01",
| |
| | |
| Locale: "en-US",
| |
| Currency: "EUR",
| |
| FundingSources: [
| |
| "All"
| |
| ],
| |
| Transactions: [
| |
| {
| |
| POSTransactionId: "fa-01-01",
| |
| | |
| Total: 50,
| |
| //Immediately after crediting €50 to teacher, €5 will be sent to the marketplace.
| |
| PayeeTransactions: [
| |
| {
| |
| POSTransactionId: "TR-01-01-01",
| |
| | |
| Total: 5,
| |
| Comment: "Marketplace commission: TR-01-01-01."
| |
| },
| |
| ],
| |
| Items: [
| |
| {
| |
| Name: "English lesson",
| |
| Description: "Advanced Business English lesson from native speaker",
| |
| Quantity: 2,
| |
| Unit: "hour",
| |
| UnitPrice: 25,
| |
| ItemTotal: 50,
| |
| SKU: "ENG-ADV-NTV"
| |
| },
| |
| ]
| |
| }
| |
| ]
| |
| }
| |
| </source>
| |
|
| |
| ==== Több szereplős piactér ====
| |
| Ez a példa egy olyan piacteret mutat be, ahol egy vásárló fizet több kézműves eladónak, akik a piactéren árulnak, és amiből a piactér részesedik 10-10%-ot.
| |
|
| |
| '''Bemenet'''
| |
| <source lang="javascript">
| |
| {
| |
| POSKey: "999FFDDA-04FF-333F-CCCC-345FCB555FFC",
| |
| PaymentType: "Immediate",
| |
| PaymentWindow: "00:30:00",
| |
| PaymentRequestId: "fa-01",
| |
| | |
| Locale: "hu-HU",
| |
| Currency: "HUF",
| |
| FundingSources: [
| |
| "All"
| |
| ],
| |
| Transactions: [
| |
| {
| |
| POSTransactionId: "fa-01-01",
| |
| | |
| Total: 5000,
| |
| //Immediately after crediting 5000 Ft to [email protected], 500 Ft will be sent to the marketplace. | |
| PayeeTransactions: [
| |
| {
| |
| POSTransactionId: "TR-01-01-01",
| |
| | |
| Total: 500,
| |
| Comment: "Marketplace facilitation fee: TR-01-01-01."
| |
| },
| |
| ],
| |
| Items: [
| |
| {
| |
| Name: "Görbe bögre",
| |
| Description: "Kézműves görbe bögre, 2dl, kerámia ",
| |
| Quantity: 1,
| |
| Unit: "db",
| |
| UnitPrice: 5000,
| |
| ItemTotal: 5000,
| |
| SKU: ""
| |
| },
| |
| ]
| |
| },
| |
| {
| |
| POSTransactionId: "fa-01-02",
| |
| | |
| Total: 3000,
| |
| //Immediately after crediting 3000 Ft to [email protected], 300 Ft will be sent to the marketplace. | |
| PayeeTransactions: [
| |
| {
| |
| POSTransactionId: "TR-01-02-01",
| |
| | |
| Total: 300,
| |
| Comment: "Marketplace facilitation fee: TR-01-02-01."
| |
| },
| |
| ],
| |
| Items: [
| |
| {
| |
| Name: "Bugylibicska",
| |
| Description: "Fa nyelű bicska, 8 cm pengével, bőr tokkal ",
| |
| Quantity: 1,
| |
| Unit: "db",
| |
| UnitPrice: 3000,
| |
| ItemTotal: 3000,
| |
| SKU: ""
| |
| },
| |
| ]
| |
| }
| |
|
| |
|
| ]
| |
| }
| |
| </source>
| |
|
| |
|
| <!-- This is a comment
| | Below are API call samples for different payment scenarios. |
| ==== me ====
| |
|
| |
|
| '''Bemenet'''
| | ==Traditional payment== |
| <source lang="javascript">
| | *[[sample-electronicsshop|Electronics shop]] |
| {
| |
| POSKey: "999FFDDA-04FF-333F-CCCC-345FCB555FFC",
| |
| PaymentType: "Immediate",
| |
| PaymentWindow: "00:30:00",
| |
|
| |
|
| GuestCheckout : "True",
| | ==Automatic payments== |
| FundingSources: [ "All" ],
| | *[[sample-oneclickpayment|Electronics shop with one click payment]] |
| | *[[sample-monthlypayment|Online TV with monthly subscription]] |
|
| |
|
| PaymentRequestId: "payment-24",
| | ==Marketplaces== |
| OrderNumber: "n/a",
| | *[[sample-onlineclass|Marketplace for online classes - single seller, marketplace commission]] |
| | | *[[sample-creativemarkeplace|Creative marketplace - multiple sellers, marketplace commission]] |
| | *[[sample-localmarkeplace|Local producers' marketplace - multiple sellers, marketplace and agent commission]] |
|
| |
|
| RedirectUrl: "http://barion.me/system/successful-payment",
| | ==Sharing Economy== |
| CallbackUrl: "http://barion.me/system/callback",
| | *[[sample-uber|Car sharing 'Uber' style - single service provider, facilitator commission]] |
|
| |
|
| Locale: "en-US",
| |
| Currency: "HUF",
| |
|
| |
|
| Transactions: [
| | {{NotificationBox|title=IMPORTANT|text=Do not copy paste these samples, because some sample parameters (such as POSKey) will not work in live environments! |color=#FF7A3D}} |
| {
| |
| POSTransactionId: "payment-24-1",
| |
| | |
| Total: 5000,
| |
| PayeeTransactions: [
| |
| {
| |
| POSTransactionId: "payment-24-1-1",
| |
| | |
| Total: 50,
| |
| Comment: "Barion me commission: payment-24-1-1"
| |
| },
| |
| ],
| |
| Items: [
| |
| {
| |
| Name: "Yesterday's beer.",
| |
| },
| |
| ]
| |
| }
| |
| ]
| |
| } | |
| </source>
| |