本文整理汇总了PHP中PayPal\Api\Transaction::setInvoiceNumber方法的典型用法代码示例。如果您正苦于以下问题:PHP Transaction::setInvoiceNumber方法的具体用法?PHP Transaction::setInvoiceNumber怎么用?PHP Transaction::setInvoiceNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PayPal\Api\Transaction
的用法示例。
在下文中一共展示了Transaction::setInvoiceNumber方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createTransaction
/**
* @param Amount $amount
* @param ItemList $itemLists
* @param string $invoiceNumber
* @param string $description
*
* @return Transaction
*/
public static function createTransaction(Amount $amount, ItemList $itemLists, $invoiceNumber, $description)
{
$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setItemList($itemLists);
$transaction->setInvoiceNumber($invoiceNumber);
$transaction->setDescription($description);
return $transaction;
}
示例2: createTransaction
public static function createTransaction()
{
$transaction = new Transaction();
$transaction->setAmount(AmountTest::createAmount());
$transaction->setDescription(self::$description);
$transaction->setInvoiceNumber(self::$invoiceNumber);
$transaction->setCustom(self::$custom);
$transaction->setSoftDescriptor(self::$softDescriptor);
$transaction->setItemList(ItemListTest::createItemList());
$transaction->setPayee(PayeeTest::createPayee());
$transaction->setRelatedResources(array(RelatedResourcesTest::createRelatedResources()));
return $transaction;
}
示例3: callCreate
public function callCreate($clientId, $clientSecret, $orderId, $amount, $currency, $description, $returnUrl, $cancelUrl)
{
$oauthCredential = new OAuthTokenCredential($clientId, $clientSecret);
$apiContext = new ApiContext($oauthCredential);
$apiContext->setConfig(['mode' => $this->mode]);
$payer = new Payer();
$payer->setPaymentMethod('paypal');
$item = new Item();
$item->setName($description);
$item->setCurrency($currency);
$item->setPrice($amount);
$item->setQuantity(1);
$itemList = new ItemList();
$itemList->setItems(array($item));
$amountObject = new Amount();
$amountObject->setCurrency($currency);
$amountObject->setTotal($amount);
$transaction = new Transaction();
$transaction->setItemList($itemList);
$transaction->setAmount($amountObject);
$transaction->setDescription($description);
$transaction->setInvoiceNumber($orderId);
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl($returnUrl)->setCancelUrl($cancelUrl);
$payment = new Payment();
$payment->setIntent('sale');
$payment->setPayer($payer);
$payment->setRedirectUrls($redirectUrls);
$payment->setTransactions(array($transaction));
try {
$payment->create($apiContext);
} catch (\Exception $e) {
throw new PaymentException('PayPal Exception: ' . $e->getMessage());
}
$approvalUrl = $payment->getApprovalLink();
return $approvalUrl;
}
示例4: setPaypalTransaction
public function setPaypalTransaction($amount, $descr, $invoiceNumber, $itemList)
{
$transaction = new Transaction();
$transaction->setAmount($amount);
$transaction->setDescription($descr);
$transaction->setInvoiceNumber($invoiceNumber);
$transaction->setItemList($itemList);
return $transaction;
}