sveawebpay / php-integration

SDK for Sveas payment methods (standalone and Svea Checkout)
Other
15 stars 19 forks source link

How to make a delivery of a checkout order #87

Closed watta90 closed 4 years ago

watta90 commented 4 years ago

Hi,

I'm not able to find in the documentation on how to make a delivery of a checkout order. Can you please provide an example on how to do this?

I can't use the WebPay::deliverOrder because my Checkout Order ID isn't the same as Svea Order ID so the API doesn't find the order. Can I get the Svea Order ID using my Checkout Order ID and then call WebPay::deliverOrder?

Thanks in advance

fre-sund commented 4 years ago

Hi,

Here's an example of how to deliver a checkout order https://github.com/sveawebpay/php-integration/blob/master/example/checkout/admin/deliver-order.php

You'll need to use WebpayAdmin::deliverOrderRows and set the checkoutOrderId :)

Br, fre-sund

watta90 commented 4 years ago

I think I found the proper way to do this.

$request = WebPayAdmin::deliverOrderRows($config)
                 ->setCheckoutOrderId($mySveaCheckoutId)
             ->setCountryCode($countryCode);
$response = $request->deliverCheckoutOrder()->doRequest();

The WebPayAdmin::deliverOrderRows->deliverCheckoutOrder() is where the magic happens. You need to handle checkout orders that have been made with bank transfers because the call deliverCheckoutOrder() will fail for those.

fre-sund commented 4 years ago

Yes, bank orders will fail if that method is used since they get set to delivered when the transaction is finalized