Plugin to use QIWI as a gateway.
Release builds are available on Maven Central with coordinates org.kill-bill.billing.plugin.ruby:qiwi-plugin
.
Plugin version | Kill Bill version |
---|---|
0.x.y | 0.16.z |
The plugin needs a database. The latest version of the schema can be found here.
curl -v \
-X POST \
-u admin:password \
-H 'X-Killbill-ApiKey: bob' \
-H 'X-Killbill-ApiSecret: lazar' \
-H 'X-Killbill-CreatedBy: admin' \
-H 'Content-Type: text/plain' \
-d ':qiwi:
:account_id: "your-account-id"' \
http://127.0.0.1:8080/1.0/kb/tenants/uploadPluginConfig/killbill-qiwi
Add a default payment method:
curl -v \
-X POST \
-u admin:password \
-H 'X-Killbill-ApiKey: bob' \
-H 'X-Killbill-ApiSecret: lazar' \
-H 'X-Killbill-CreatedBy: admin' \
-H 'Content-Type: application/json' \
-d '{
"pluginName": "killbill-qiwi",
"pluginInfo": {
"properties": []
}
}' \
"http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/paymentMethods?isDefault=true"
Call buildFormDescriptor:
curl -v \
-u admin:password \
-H 'X-Killbill-ApiKey: bob' \
-H 'X-Killbill-ApiSecret: lazar' \
-H 'Content-Type: application/json' \
-H 'X-Killbill-CreatedBy: demo' \
-X POST \
--data-binary '{
"formFields": [
{
"key": "order_id",
"value": "1234"
},
{
"key": "amount",
"value": "750"
}
]
}' \
"http://127.0.0.1:8080/1.0/kb/paymentGateways/hosted/form/<ACCOUNT_ID>"
The response will look like:
{
"kbAccountId": "<ACCOUNT_ID>",
"formMethod": "GET",
"formUrl": "https://w.qiwi.com/payment/form.action",
"formFields": {
"amount": "750",
"id": "1234",
"provider": "11223344"
},
"properties": {},
"auditLogs": null
}
This indicates that the user should be redirected to https://w.qiwi.com/payment/form.action?amount=750&id=1234&provider=11223344.
Upon success, following the redirect from QIWI, record the payment in Kill Bill:
curl -v \
-X POST \
-u admin:password \
-H 'Content-Type: application/json' \
-H 'X-Killbill-ApiKey:bob' \
-H 'X-Killbill-ApiSecret:lazar' \
-H 'X-Killbill-CreatedBy: creator' \
--data-binary '{"transactionType":"PURCHASE","amount":"750"}' \
"http://127.0.0.1:8080/1.0/kb/accounts/<ACCOUNT_ID>/payments"