CheckoutFinland / psp-api

5 stars 5 forks source link

how to create client for shop in shop #45

Open nabeelzqadri opened 4 years ago

nabeelzqadri commented 4 years ago

how to create client for shop in shop

nabeelzqadri commented 4 years ago

@jrasanen @akx @vesse @mikaturunen can you please update the read me for "shop-in-shop" client

loueranta commented 4 years ago

Could you please be more specific? Do you want to create a shop-in-shop merchant or build a marketplace?

nabeelzqadri commented 4 years ago

I want to use shop in shop merchant for payment api?

On Tue, Nov 12, 2019, 5:26 PM Joonas Loueranta notifications@github.com wrote:

Could you please be more specific? Do you want to create a shop-in-shop merchant or build a marketplace?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CheckoutFinland/psp-api/issues/45?email_source=notifications&email_token=AL2XSDHVON7MZJFVPAKKFY3QTKOGJA5CNFSM4JMAOKV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOED2CRHA#issuecomment-552872092, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL2XSDDC45UMBOC3JT5C2FTQTKOGJANCNFSM4JMAOKVQ .

vesse commented 4 years ago

When creating a shop-in-shop payment the request is signed with the aggregate merchant ID and secret key, and each item must have a valid shop-in-shop merchant ID. The request payload documentation lists fields that are required for a shop-in-shop payment.

With the given test merchant accounts, you would create a payment with body like this:

{
  "stamp": "unique-for-the-aggregate",
  "reference": "123",
  "amount": 1000,
  "currency": "EUR",
  "language": "EN",
  "items": [
    {
      "unitPrice": 500,
      "units": 2,
      "vatPercentage": 24,
      "stamp": "unique-for-shop-in-shop-merchant",
      "reference": "123_1",
      "merchant": "695874"
    }
  ],
  "customer": {
    "email": "customer@example.org"
  },
  "redirectUrls": {
    "success": "https://shop.example.org/cart/success",
    "cancel": "https://shop.example.org/cart/cancel"
  },
  "callbackUrls": {
    "success": "https://shop.example.org/cart/callback/success",
    "cancel": "https://shop.example.org/cart/callback/cancel"
  }
}

and sign the request with merchant 695861 and secret key MONISAIPPUAKAUPPIAS

terolahtinen commented 4 years ago

Can you provide a complete php example for shop-in-shop, please. We would need that at the latest 4 weeks before closing of old api.

ravisoni6262 commented 3 years ago

@vesse Could you please give an example of how to set commission property?

reisseli commented 3 years ago

@ravisoni6262 Commission is given as part of the item element for all items you want to charge commission for. The fields that need to be passed are described here https://checkoutfinland.github.io/psp-api/#/?id=commission.

Using the earlier example in this thread, charging a 5 cent commission you would have the following body.

{
  "stamp": "unique-for-the-aggregate",
  "reference": "123",
  "amount": 1000,
  "currency": "EUR",
  "language": "EN",
  "items": [
    {
      "unitPrice": 500,
      "units": 2,
      "vatPercentage": 24,
      "stamp": "unique-for-shop-in-shop-merchant",
      "reference": "123_1",
      "merchant": "695874",
      "commission": {
        "merchant": "695874",
        "amount": 5
      }
    }
  ],
  "customer": {
    "email": "customer@example.org"
  },
  "redirectUrls": {
    "success": "https://shop.example.org/cart/success",
    "cancel": "https://shop.example.org/cart/cancel"
  },
  "callbackUrls": {
    "success": "https://shop.example.org/cart/callback/success",
    "cancel": "https://shop.example.org/cart/callback/cancel"
  }
}

NOTE: For production use you would not pass the same merchant in the commission element that you are passing on the item-level (the receiver of the commission is not the same merchant than the one that is being charged for the commission) but as there is no separate commission account for testing, you can use the same merchant for testing purposes.

ravisoni6262 commented 2 years ago

@ravisoni6262 Commission is given as part of the item element for all items you want to charge commission for. The fields that need to be passed are described here https://checkoutfinland.github.io/psp-api/#/?id=commission.

Using the earlier example in this thread, charging a 5 cent commission you would have the following body.

{
  "stamp": "unique-for-the-aggregate",
  "reference": "123",
  "amount": 1000,
  "currency": "EUR",
  "language": "EN",
  "items": [
    {
      "unitPrice": 500,
      "units": 2,
      "vatPercentage": 24,
      "stamp": "unique-for-shop-in-shop-merchant",
      "reference": "123_1",
      "merchant": "695874",
      "commission": {
        "merchant": "695874",
        "amount": 5
      }
    }
  ],
  "customer": {
    "email": "customer@example.org"
  },
  "redirectUrls": {
    "success": "https://shop.example.org/cart/success",
    "cancel": "https://shop.example.org/cart/cancel"
  },
  "callbackUrls": {
    "success": "https://shop.example.org/cart/callback/success",
    "cancel": "https://shop.example.org/cart/callback/cancel"
  }
}

NOTE: For production use you would not pass the same merchant in the commission element that you are passing on the item-level (the receiver of the commission is not the same merchant than the one that is being charged for the commission) but as there is no separate commission account for testing, you can use the same merchant for testing purposes. @jfrojd Here is my JSON for shop-in-shop:

  • but in payment reports, shopInShopCommission is null.
  • {"stamp":"1-6631-1632310462","reference":"6631","amount":200,"currency":"EUR","language":"EN","items":[{"unitPrice":100,"units":1,"vatPercentage":0,"productCode":"5396","deliveryDate":"2021-09-22","description":"Coppa Ham Sliced (55g)","stamp":"560","reference":"6631","merchant":"695874","commission":{"merchant":"695874","amount":2}},{"unitPrice":100,"units":1,"vatPercentage":0,"productCode":"shipping","deliveryDate":"2021-09-22","description":"Flat Rate","stamp":"561","reference":"6631","merchant":"695874","commission":{"merchant":"695874","amount":2}}],"customer":{"email":"adam@mailinator.com","firstName":"Adam","lastName":"Robertson","phone":"07595326007"},"deliveryAddress":{"streetAddress":"12 Devonshire Gardens","postalCode":"W4 3TN","city":"London","county":"London","country":"GB"},"invoicingAddress":{"streetAddress":"12 Devonshire Gardens","postalCode":"W4 3TN","city":"London","county":"London","country":"GB"},"redirectUrls":{"success":"https://fojo.express.net.in/checkout/order-received/6631/?key=wc_order_48YIzSpqbpXm9","cancel":"https://fojo.express.net.in/cart/?cancel_order=true&order=wc_order_48YIzSpqbpXm9&order_id=6631&redirect&_wpnonce=e2a740e2c5"},"callbackUrls":{"success":"https://fojo.express.net.in/op-payment-service/callback/index","cancel":"https://fojo.express.net.in/op-payment-service/callback/index"}}