开发者

delivery format for sagepay basket

开发者 https://www.devze.com 2023-02-12 05:22 出处:网络
sage pay is throwing an error about my basket. if i take the delivery part off then it works but i want delivery on.

sage pay is throwing an error about my basket. if i take the delivery part off then it works but i want delivery on.

// Ordering Shopping Basket
    // 
    $ThisBasket = count( $items );
    foreach( $items as $item ) {
        preg_match( "#^\[([^\]]+)\]\[([^\]]+)\]\[([^\]]+)\]$#is", $item, $match );
        $ThisBasket .= ':' . $match[2]; // Item Name ( - attri开发者_StackOverflowbute/options )
        $ThisBasket .= ':' . $match[1]; // Quantity
        $ThisBasket .= ':' . self::$cp . ( $match[3] / $match[1] ); //Item Value
        $ThisBasket .= ':' . self::$cp . global_data::get_vat( $match[3] / $match[1], true ); // Item Tax
        $ThisBasket .= ':' . self::$cp . global_data::get_vat( $match[3] / $match[1] ); // // Item Total
        $ThisBasket .= ':' . self::$cp . global_data::get_vat( $match[3] ); // // Line Total
    }
    $ThisBasket .= ':Delivery:1:' . self::$cp . '4.99:---:' . self::$cp . '4.99:' . self::$cp . '4.99';

I have no idea how the delivery is structured and cannot find any documentation. regards phil


From the VSP Direct documentation (formatted appropriately):

Item                   Quantity   Item value  Item tax  Item Total  Line Total
Sound system           1          424.68      74.32     499.00      499.00
Donnie Darko           3          11.91       2.08      13.99       41.97
Finding Nemo           2          11.05       1.94      12.99       25.98
Delivery               ---        ---         ---       ---         4.99

Would be represented thus:

4:Pioneer NSDV99 DVD-Surround Sound System:1:424.68:74.32:499.00: 499.00:Donnie Darko Director’s Cut:3:11.91:2.08:13.99:41.97: Finding Nemo:2:11.05:1.94:12.99:25.98:Delivery:---:---:---:---:4.99

So it looks like you just need to include the total of the delivery, with --- as appropriate to complete the blank fields. Not sure what self::$cp is in your code, but if you have the total, just use that.

0

精彩评论

暂无评论...
验证码 换一张
取 消