I am using mindbody api, I am success for payment but I want to add promotion code, I think I am right for add promotion code because when I add promo code then it's give message like (The input payment total (90) does not match the calculated total (45) for the entire cart.). Here my total amount is 90/- but calculate amount is 45/- (50% discount).
My code is :
$shoppingCart = array(
'ClientID' => $client_id,
'Test' => true,
'PromotionCode' => $promotion_code, //add by NIK
'CartItems' => array(
'CartItem' => array(
'Quantity' => $product_qty,
'Item' => new SoapVar(
array('ID' => $product_id), SOAP_ENC_ARRAY, 'Service', 'http://clients.mindbodyonline.com/api/0_5'
),
'DiscountAmount' => 0
)
),
'Payments' => array(
'PaymentInfo' => new SoapVar(
array(
'CreditCardNumber' => $ccnumber,
'BillingName' => "$ccname",
'BillingAddress' => "$BillingAddress",
'BillingCity' => "$BillingCity",
'BillingState' => "$BillingState",
'ExpYear' => $ccyear,
'ExpMonth' => $ccm,
'Amount' => round($OnlinePrice, 2),
'BillingPostalCode' => $ccbaddresszip
), SOAP_ENC_ARRAY, 'CreditCardInfo', 'http://clients.mindbodyonline.com/api/0_5'
)
)
);
[CheckoutShoppingCartResult] => stdClass Object
(
[Status] => InvalidParameters
[ErrorCode] => 900
[Message] => The input payment total (90) does not match the calculated total (45) for the entire cart.
[XMLDetail] => Full
[ResultCount] => 0
[CurrentPageIndex] => 0
[TotalPageCount] => 0
[CheckoutShoppingCartResult] => stdClass Object
(
[Status] => Success
[ErrorCode] => 200
[XMLDetail] => Full
[ResultCount] => 0
[CurrentPageIndex] => 0
[TotalPageCount] => 0
[ShoppingCart] => stdClass Object
(
[ID] => eb589ede-5044-4e1c-9f6a-65f165790388
[CartItems] => stdClass Object
(
[CartItem] => stdClass Object
(
[Item] => stdClass Object
(
[Price] => 90.0000
[OnlinePrice] => 90.0000
[TaxIncluded] => 0
[ProgramID] => 25
[TaxRate] => 0
[ProductID] => 10158
[ID] => 10158
[Name] => Pack of 4 x Sweat Sessions
[Count] => 4
)
[DiscountAmount] => 0
[ID] => 1
[Quantity] => 1
)
)
[SubTotal] => 90
[DiscountTotal] => 0
[TaxTotal] => 15
[GrandTotal] => 90
)
)
)
Before running this example, set up a promotion code on the sandbox subscriber that gives a 50% discount to all pricing options and retail products.
Use this call to ensure the total amount being reconciled by all payment methods matches the cart's calculated total. Because Test is true, this call will not actually make a sale, but will validate the cart. Once you get a ErrorCode of 200 in the response, set Test to false, and run the call to actually complete the purchase.
You can run this call against the sandbox subscriber.
Note that the call is passing UserCredentials, indicating that the sale is being run by a staff member. In this case, the owner of the sandbox subscriber.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<CheckoutShoppingCart xmlns="http://clients.mindbodyonline.com/api/0_5">
<Request>
<SourceCredentials>
<SourceName>{SourceName}</SourceName>
<Password>{Password}</Password>
<SiteIDs>
<int>-99</int>
</SiteIDs>
</SourceCredentials>
<UserCredentials>
<Username>Siteowner</Username>
<Password>apitest1234</Password>
<SiteIDs>
<int>-99</int>
</SiteIDs>
<LocationID>0</LocationID>
</UserCredentials>
<XMLDetail>Full</XMLDetail>
<ClientID>100014787</ClientID>
<Test>true</Test>
<CartItems>
<CartItem>
<Item xsi:type="Service">
<ID>1249</ID>
</Item>
<DiscountAmount>0</DiscountAmount>
<Quantity>1</Quantity>
</CartItem>
</CartItems>
<InStore>true</InStore>
<Payments>
<PaymentInfo xsi:type="CashInfo">
<Amount>5</Amount>
</PaymentInfo>
</Payments>
<SendEmail>false</SendEmail>
<LocationID>1</LocationID>
<PromotionCode>633697002970</PromotionCode>
</Request>
</CheckoutShoppingCart>
</soapenv:Body>
</soapenv:Envelope>
Response:
<CheckoutShoppingCartResponse xmlns="http://clients.mindbodyonline.com/api/0_5">
<CheckoutShoppingCartResult>
<Status>Success</Status>
<ErrorCode>200</ErrorCode>
<XMLDetail>Full</XMLDetail>
<ResultCount>0</ResultCount>
<CurrentPageIndex>0</CurrentPageIndex>
<TotalPageCount>0</TotalPageCount>
<ShoppingCart>
<ID>9c718c54-428c-4e1e-8221-9868078e6969</ID>
<CartItems>
<CartItem>
<Item xsi:type="Service">
<Price>10.0000</Price>
<OnlinePrice>10.0000</OnlinePrice>
<ProgramID>26</ProgramID>
<TaxRate>0</TaxRate>
<ProductID>1249</ProductID>
<ID>1249</ID>
<Name>Non Member Drop In</Name>
<Count>1</Count>
</Item>
<DiscountAmount>0</DiscountAmount>
<ID>1</ID>
<Quantity>1</Quantity>
</CartItem>
</CartItems>
<SubTotal>10</SubTotal>
<DiscountTotal>5</DiscountTotal>
<TaxTotal>0</TaxTotal>
<GrandTotal>5</GrandTotal>
</ShoppingCart>
</CheckoutShoppingCartResult>
</CheckoutShoppingCartResponse>