Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • создаем в Платформе инвойс:

    Code Block
    languagejs
    curl -X POST \
      https://api.rbk.moneyintellectmoney/ru/merchant/v2/processing/invoices \
      -H 'Authorization: Bearer {YOUR_API_KEY}' \
      -H 'Cache-Control: no-cache' \
      -H 'Content-Type: application/json; charset=utf-8' \
      -H 'X-Request-ID: 1528470572' \
      -d '{
      "shopID": "TEST",
      "dueDate": "2018-06-08T14:56:31.416Z",
      "amount": 6000,
      "currency": "RUB",
      "product": "Order num 12345",
      "description": "Delicious meals",
        "cart": [
            {
                "price": 5000,
                "product": "Sandwich",
                "quantity": 1,
                "taxMode": {
                    "rate": "10%",
                    "type": "InvoiceLineTaxVAT"
                }
            },
            {
                "price": 1000,
                "product": "Cola",
                "quantity": 1,
                "taxMode": {
                    "rate": "18%",
                    "type": "InvoiceLineTaxVAT"
                }
            }
        ],  
    "metadata": 
      { 
        "order_id": "Internal order num 13123298761"
      }
    }'


  • пример ответа Платформы:

    Code Block
    languagejs
    {
        "invoice": {
            "amount": 6000,
            "cart": [
                {
                    "cost": 5000,
                    "price": 5000,
                    "product": "Sandwich",
                    "quantity": 1,
                    "taxMode": {
                        "rate": "10%",
                        "type": "InvoiceLineTaxVAT"
                    }
                },
                {
                    "cost": 1000,
                    "price": 1000,
                    "product": "Cola",
                    "quantity": 1,
                    "taxMode": {
                        "rate": "18%",
                        "type": "InvoiceLineTaxVAT"
                    }
                }
            ],
            "createdAt": "2018-06-08T13:56:31.188182Z",
            "currency": "RUB",
            "description": "Delicious meals",
            "dueDate": "2018-06-08T14:56:31.416000Z",
            "id": "10vLw0XY144",
            "metadata": {
                "order_id": "Internal order num 13123298761"
            },
            "product": "Order num 12345",
            "shopID": "TEST",
            "status": "unpaid"
        },
        "invoiceAccessToken": {
            "payload": "{INVOICE_ACCESS_TOKEN}"
        }
    }


  • обрабатываем в UA плательщика бизнес-процесс Google Pay, передаем полученные данные себе на бекэнд и вызываем createPaymentResource():

    Code Block
    languagejs
    curl -X POST \
      https://api.rbk.money/v2/processing/payment-resources \
      -H 'Authorization: Bearer {INVOICE_ACCESS_TOKEN}' \
      -H 'Cache-Control: no-cache' \
      -H 'Content-Type: application/json; charset=utf-8' \
      -H 'X-Request-ID: 1528470722' \
      -d '{
      "paymentTool": {
        "paymentToolType": "TokenizedCardData",
        "provider": "GooglePay",
        "gatewayMerchantID": "rbkmoney-test",
        "paymentToken": {
          "cardInfo": {
            "cardNetwork": "MASTERCARD",
            "cardDetails": "4444",
            "cardImageUri": "https://lh6.ggpht.com/h6TBIVV7tlYGr1zkIA8CmCzINizzASbPIetpxh_5otBu3VkPEC5_Kk_wH5szy7gDhMkRhVVp",
            "cardDescription": "Mastercard •••• 4444",
            "cardClass": "CREDIT"
          },
          "paymentMethodToken": {
            "tokenizationType": "PAYMENT_GATEWAY",
            "token": "{\"signature\":\"MEUCIZ29vZ2xlIHBheSBkZWNvZGVkIHNpZ25hdHVyZSBkYXRhIChiaW5hcnkpCg\\u003d\",\"protocolVersion\":\"ECv1\",\"signedMessage\":\"{\\\"encryptedMessage\\\":\\\"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdCwg//c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQgdXQgbGFib3JlIGV0IGRvbG9yZSBtYWdu//YSBhbGlxdWEuIFV0IGVuaW0gYWQgbWluaW0gdmVuaWFtLCBxdWlzIG5vc3RydWQgZXhlcmNpdGF0//aW9uIHVsbGFtY28gbGFib3JpcyBuaXNpIHV0IGFsaXF1aXAgZXggZWEgY29tbW9kbyBjb25zZXF1YXQuCg\\\",\\\"ephemeralPublicKey\\\":\\\"Z29vZ2xlIHBheSBlbXBoZXJhbCBwdWJsaWMga2V5IChkZWNvZGVkIGJpbmFyeSkK\\\\u003d\\\",\\\"tag\\\":\\\"Z29vZ2xlIHBheSB0YWcgKGRlY29kZWQgYmluYXJ5KQo\\\\u003d\\\"}\"}"
          }
        }
      },
      "clientInfo": {
        "fingerprint": "aa32fec9f377e6fae19a6a8bcde41bd1"
      }
    }'

...


  • пример ответа Платформы:

    Code Block
    languagejs
    {
        "clientInfo": {
            "fingerprint": "aa32fec9f377e6fae19a6a8bcde41bd1",
            "ip": "2A04:4A00:5:1014::100D"
        },
        "paymentSession": "{PAYMENT_SESSION}",
        "paymentToolDetails": {
            "bin": "411111",
            "cardNumberMask": "411111******4444",
            "detailsType": "PaymentToolDetailsBankCard",
            "lastDigits": "4444",
            "paymentSystem": "mastercard",
            "tokenProvider": "googlepay"
        },
        "paymentToolToken": "{PAYMENT_TOOL_TOKEN}"
    }

...


  • запускаем платеж в Платформе

    Code Block
    languagejs
    curl -X POST \
      https://api.rbk.money/v2/processing/invoices/10vLw0XY144/payments \
      -H 'Authorization: Bearer {INVOICE_ACCESS_TOKEN}' \
      -H 'Cache-Control: no-cache' \
      -H 'Content-Type: application/json; charset=utf-8' \
      -H 'X-Request-ID: 1528470852' \
      -d '{
      "flow": {
        "type": "PaymentFlowInstant"
      },
      "payer": {
          "payerType": "PaymentResourcePayer",
        "paymentToolToken":"{PAYMENT_TOOL_TOKEN}",
        "paymentSession":"{PAYMENT_SESSION}",
        "contactInfo":
          {
            "email":"test@test.com",
            "phoneNumber":"9876543210"
          }
      }
    }'

...



  • проверяем статус обработки платежа:

    Code Block
    languagejs
    curl -X GET \
      https://api.rbk.money/v2/processing/invoices/10vRl9xqGlk/docs/payments/1 \
      -H 'Authorization: Bearer {YOUR_API_KEY}' \
      -H 'Cache-Control: no-cache' \
      -H 'Content-Type: application/json; charset=utf-8' \
      -H 'X-Request-ID: 1528471100'

...


  • пример ответа Платформы. Платеж успешно проведен:

    Code Block
    languagejs
    {
        "amount": 6000,
        "createdAt": "2018-06-08T15:18:06.834793Z",
        "currency": "RUB",
        "flow": {
            "type": "PaymentFlowInstant"
        },
        "id": "1",
        "invoiceID": "10vRl9xqGlk",
        "payer": {
            "clientInfo": {
                "fingerprint": "aa32fec9f377e6fae19a6a8bcde41bd1",
                "ip": "2A04:4A00:5:1014::100D"
            },
            "contactInfo": {
                "email": "test@test.com",
                "phoneNumber": "9876543210"
            },
            "payerType": "PaymentResourcePayer",
            "paymentSession": "{PAYMENT_SESSION}",
            "paymentToolDetails": {
                "bin": "411111",
                "cardNumberMask": "411111******4444",
                "detailsType": "PaymentToolDetailsBankCard",
                "lastDigits": "4444",
                "paymentSystem": "mastercard",
                "tokenProvider": "googlepay"
            },
            "paymentToolToken": "{PAYMENT_TOOL_TOKEN}"
        },
        "status": "captured"
    }