PayPal\Service\PayPalAPIInterfaceServiceService::BillUser PHP Method

BillUser() public method

Service Call: BillUser
public BillUser ( BillUserReq $billUserReq, mixed $apiCredential = null ) : BillUserResponseType
$billUserReq PayPal\PayPalAPI\BillUserReq
$apiCredential mixed - Optional API credential - can either be a username configured in sdk_config.ini or a ICredential object created dynamically
return PayPal\PayPalAPI\BillUserResponseType
    public function BillUser($billUserReq, $apiCredential = null)
    {
        $apiContext = new PPApiContext($this->config);
        $handlers = array(new PPMerchantServiceHandler($apiCredential, self::$SDK_NAME, self::$SDK_VERSION));
        $this->setStandardParams($billUserReq->BillUserRequest);
        $ret = new BillUserResponseType();
        $resp = $this->call('PayPalAPI', 'BillUser', $billUserReq, $apiContext, $handlers);
        $ret->init(PPUtils::xmlToArray($resp));
        return $ret;
    }

Usage Example

Beispiel #1
0
$MPPaymentDetails->Handling = new BasicAmountType($currencyId, $_REQUEST['handling']);
$MPPaymentDetails->Tax = new BasicAmountType($currencyId, $_REQUEST['tax']);
$MPPaymentDetails->PaymentType = $_REQUEST['paymentCodeType'];
$MPPaymentDetails->EmailSubject = $_REQUEST['mailSubject'];
$MPPaymentDetails->ItemName = $_REQUEST['itemName'];
$MPPaymentDetails->ItemNumber = $_REQUEST['itemNum'];
$MPPaymentDetails->Memo = $_REQUEST['memo'];
$MPPaymentDetails->MpID = $_REQUEST['billingAgreementID'];
$billUserReqest = new BillUserRequestType();
$billUserReqest->MerchantPullPaymentDetails = $MPPaymentDetails;
$billUserReq = new BillUserReq();
$billUserReq->BillUserRequest = $billUserReqest;
/*
 * 	 ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and config parameters
*/
$paypalService = new PayPalAPIInterfaceServiceService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $billUserResponse = $paypalService->BillUser($billUserReq);
} catch (Exception $ex) {
    include_once "../Error.php";
    exit;
}
if (isset($billUserResponse)) {
    echo "<pre>";
    print_r($billUserResponse);
    echo "</pre>";
}
require_once '../Response.php';