delivery format for sagepay basket
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.
精彩评论