Last active
May 11, 2016 19:27
-
-
Save ChrisFlannagan/c7cb218f192a4f36fc1eda4cb159c3bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//PayPal wants an array of InvoiceItem() objects | |
$items = array() | |
$cnt = 0; | |
foreach( $order['items'] as $item ) { | |
$items[ $cnt ] = new InvoiceItem(); | |
$items[ $cnt ] | |
->setName( $item['outfit'] . '-' . $item['size'] ) | |
->setQuantity( 1 ) | |
->setUnitPrice( new Currency() ); | |
$items[ $cnt ]->getUnitPrice() | |
->setCurrency( "USD" ) | |
->setValue( $anitem['total'] ); | |
if( $anorder['res'] == 'yes' ) { | |
$tax = new \PayPal\Api\Tax(); | |
$tax->setPercent( 4 )->setName( "Local Tax" ); | |
$items[ $cnt ]->setTax( $tax ); | |
} | |
$cnt++; | |
} | |
$invoice->setItems( $items ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment