Product Docs Help

creditPayment

creditPayment is used for crediting payments.

The original payment could be credited fully or partially.

If partcredit flag is false, then no articles are required to be sent since complete invoice is credited.

If partcredit flag is true, then add all articles that should be credited. Note that all amounts in a credit invoice have same sign as in original invoice, thus aprice and withouttax are positive values.

An example can be found here Credit payment example

Request

Data

Property

Required

Type

Description

PaymentData

true

object

Payment data

Articles

false

array

Articles is the list of articles that should be credited.

Cart

false

object

Cart is the cart that should be credited.

PaymentData

Property

Required

Type

Description

number

true

int

The payment number of the payment you wish to credit.

partcredit

false

bool

If part credit is true, then articles that should be credited and the cart needs to be specified as below. If part credit is false, then full amount is always credited. Default is false.

action

false

string

The action to be taken on the payment.

feeid

false

int

Fee to credit. This can not be set for part credit. Feeid have to match the original feeid.

Action

The default behavior is to credit and activate the credit.

If you want to credit the payment without activating it, you can specify the action as credit.

If you wish to activate an existing credit, you can specify the action as activate.

If you wish to credit the payment and activate the credit, you can specify the action as credit|activate.

To use multiple actions, separate them with a pipe |.

Numerical values can be used instead of the string values.

Action

Description

credit

Credit the payment.

activate

Activate the credit.

credit|activate

Credit and activate.

1

Credit the payment.

2

Activate the credit.

1|2

Credit and activate.

3

Credit and activate.

It is possible to mix the numerical and string values.

Articles

Articles are an array of objects with the following properties:

Property

Required

Type

Description

taxrate

true

dec

Article tax rate in percent.

withouttax

true

dec

Total article row excluding tax in 1/100 of currency (i.e. öre if currency is SEK, cent if currency is EUR). Amount given will overwrite any errors in rounding of articles row sum. Mandatory since at least one article is required to add up to total.withouttax. Note When a discount is applicable on the article, you have to deduct the discount amount from the withouttax amount.

artnr

false

string

Article number.

title

true

string

Article description.

quantity

false

dec

Article quantity.

aprice

false

dec

Article unit price without tax in 1/100 of currency (i.e. öre if currency is SEK, cent if currency is EUR).

discount

false

dec

Article discount in %.

unit

false

enum

Article unit. Defaults to 'st' if none given.

Unit enum

  • dag

  • km

  • kr

  • pkt

  • st

  • tim

  • m

  • ton

  • m2

  • m3

  • kbm

  • pall

  • kolli

  • mil

  • l

  • kg

  • box

  • dosa

  • [empty string]

  • kvm

  • nok

  • cm

Cart

Property

Required

Type

Description

Total

true

object

Total summary of payment

Handling

false

object

Cost for handling

Shipping

false

object

Cost for shipping

Cart Total

Property

Required

Type

Description

withouttax

true

int

Total payment excluding tax in 1/100 of currency (i.e. öre if currency is SEK, cent if currency is EUR). Amount given will be checked against summation of all articles[x].withouttax, handlingcharge.withouttax and shipping.withouttax. If not matching values, an error will be returned.

tax

true

int

Total tax in 1/100 of currency (i.e. öre if currency is SEK, cent if currency is EUR).

withtax

true

int

Total payment including tax in 1/100 of currency (i.e. öre if currency is SEK, cent if currency is EUR). Note Total Payment with Tax must be equal to Total Payment Excluding Tax + Total Tax + Rounding. This is a double check to make sure no rounding errors are present and payment always will be correct.

rounding

false

dec

Rounding in 1/100 of currency (i.e. öre if currency is SEK, cent if currency is EUR).

Cart Handling

Property

Required

Type

Description

withouttax

false

dec

Handling charge in 1/100 of currency (i.e. öre if currency is SEK, cent if currency is EUR).

taxrate

false

dec

Handling vat rate in %.

Cart Shipping

Property

Required

Type

Description

withouttax

false

dec

Shipping charge in 1/100 of currency (i.e. öre if currency is SEK, cent if currency is EUR).

taxrate

false

dec

Shipping vat rate in %.

Function

Property

Required

Type

Description

function

true

string

The function name to be used, for this page it’s cancelPayment

{ "credentials": { "id": "12345", "hash": "30744d308f0102c5f17d5dbce18bb23131740fd73a6a00163c4064384395c467ae2a92375f18189a63be95b9a68eaebd3f86f019e33b909d9bf924e88ab74085", "version": "2.5.0", "client": "Pluginname:BillMate:1.0", "language": "sv", "serverdata": {"HTTP_HOST":"developer.qvickly.io","HTTP_CONNECTION":"keep-alive","HTTP_CACHE_CONTROL":"max-age=0","HTTP_ACCEPT":"text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8","HTTP_USER_AGENT":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/39.0.2171.95 Safari\/537.36","HTTP_ACCEPT_ENCODING":"gzip, deflate, sdch","HTTP_ACCEPT_LANGUAGE":"en-US,en;q=0.8","PATH":"\/sbin:\/usr\/sbin:\/bin:\/usr\/bin","SERVER_SOFTWARE":"Apache\/2.2.26 (Amazon)","SERVER_NAME":"developer.qvickly.io","SERVER_ADDR":"172.31.22.88","SERVER_PORT":"80","REMOTE_ADDR":"2.71.114.219","REMOTE_PORT":"53241","GATEWAY_INTERFACE":"CGI\/1.1","SERVER_PROTOCOL":"HTTP\/1.1","REQUEST_METHOD":"GET","QUERY_STRING":"","REQUEST_TIME":1421313644}, "time": "1417004339.9291 ", "test": "true" }, "data": { "PaymentData": { "number": "1000235", "partcredit": "true" }, "Articles": [ { "artnr": "A123", "title": "Article 1", "quantity": "2", "aprice": "1234", "tax": "25", "discount": "0", "withouttax": "2468" }, { "artnr": "B456", "title": "Article 2", "quantity": "3.5", "aprice": "56780", "tax": "25", "discount": "10", "withouttax": "178857" } ], "Cart": { "Handling": { "withouttax": "1000", "taxrate": "25" }, "Shipping": { "taxrate": "25" }, "Total": { "withouttax": "185325", "tax": "46331", "rounding": "44", "withtax": "231700" } } }, "function": "creditPayment" }

Response

Property

Type

Description

number

int

Number is the payment/invoice number for the purchase.

orderid

string

The unique order id generated by the shop as a reference.

status

string

Status for a successful credit payment is always: Paid. Thus, credit payments/invoices are always automatically activated.

url

string

“Payment.url” to the pdf of the credit invoice.

{ "credentials": { "hash": "36961fea06f6031ccc4ca10df664c9930f6e805731e9c1e617c68e776f0d0b3d7a540018aef546ecb6cccfd6b9be673b86ccdb6ac48b62e8bf86d43cd622c24c" }, "data": { "number": "1000236", "orderid": "12346", "status": "Credited", "url": "https://api.qvickly.io/invoice/140544658153c38f1cdf279" } }

Trying to credit a created invoice

{ "credentials": { "hash": "36961fea06f6031ccc4ca10df664c9930f6e805731e9c1e617c68e776f0d0b3d7a540018aef546ecb6cccfd6b9be673b86ccdb6ac48b62e8bf86d43cd622c24c" }, "data": { "code": "5205", "message": "Kan inte kreditera en skapad faktura eller delbetalnings faktura.", "logid": "123456789" } }
Last modified: 13 September 2024