PHP Class PayPal\Api\Payment

Lets you create, process and manage payments.
Inheritance: extends PayPal\Common\PayPalResourceModel
显示文件 Open project: paypal/rest-api-sdk-php Class Usage Examples

Public Methods

Method Description
addBillingAgreementToken ( string $billingAgreementToken ) Append BillingAgreementTokens to the list.
addFailedTransaction ( Error $error ) Append FailedTransactions to the list.
addTransaction ( Transaction $transaction ) Append Transactions to the list.
all ( array $params, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : PaymentHistory List payments that were made to the merchant who issues the request. Payments can be in any state.
create ( ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : Payment Creates and processes a payment. In the JSON request body, include a payment object with the intent, payer, and transactions. For PayPal payments, include redirect URLs in the payment object.
execute ( PaymentExecution $paymentExecution, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : Payment Executes, or completes, a PayPal payment that the payer has approved. You can optionally update selective payment information when you execute a payment.
get ( string $paymentId, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : Payment Shows details for a payment, by ID.
getApprovalLink ( ) : null | string Get Approval Link
getBillingAgreementTokens ( ) : string[] Collection of PayPal generated billing agreement tokens.
getCart ( ) : string ID of the cart to execute the payment.
getCreateTime ( ) : string Payment creation time as defined in RFC 3339 Section 5.6.
getCreditFinancingOffered ( ) : PayPal\Api\CreditFinancingOffered Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in
getExperienceProfileId ( ) : string PayPal generated identifier for the merchant's payment experience profile. Refer to this link to create experience profile ID.
getFailedTransactions ( ) : Error[] Applicable for advanced payments like multi seller payment (MSP) to support partial failures
getFailureReason ( ) : string Failure reason code returned when the payment failed for some valid reasons.
getId ( ) : string Identifier of the payment resource created.
getIntent ( ) : string Payment intent.
getNoteToPayer ( ) : string free-form field for the use of clients to pass in a message to the payer
getPayee ( ) : Payee Receiver of funds for this payment.
getPayer ( ) : Payer Source of the funds for this payment represented by a PayPal account or a direct credit card.
getPaymentInstruction ( ) : PayPal\Api\PaymentInstruction Instructions for the payer to complete this payment.
getPotentialPayerInfo ( ) : PotentialPayerInfo Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.
getRedirectUrls ( ) : PayPal\Api\RedirectUrls Set of redirect URLs you provide only for PayPal-based payments.
getState ( ) : string The state of the payment, authorization, or order transaction. The value is:
  • created. The transaction was successfully created.
  • approved. The buyer approved the transaction.
  • failed. The transaction request failed.
getTransactions ( ) : Transaction[] Transactional details including the amount and item details.
getUpdateTime ( ) : string Payment update time as defined in RFC 3339 Section 5.6.
removeBillingAgreementToken ( string $billingAgreementToken ) Remove BillingAgreementTokens from the list.
removeFailedTransaction ( Error $error ) Remove FailedTransactions from the list.
removeTransaction ( Transaction $transaction ) Remove Transactions from the list.
setBillingAgreementTokens ( string[] $billing_agreement_tokens ) Collection of PayPal generated billing agreement tokens.
setCart ( string $cart ) ID of the cart to execute the payment.
setCreateTime ( string $create_time ) Payment creation time as defined in RFC 3339 Section 5.6.
setCreditFinancingOffered ( PayPal\Api\CreditFinancingOffered $credit_financing_offered ) Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in
setExperienceProfileId ( string $experience_profile_id ) PayPal generated identifier for the merchant's payment experience profile. Refer to this link to create experience profile ID.
setFailedTransactions ( Error[] $failed_transactions ) Applicable for advanced payments like multi seller payment (MSP) to support partial failures
setFailureReason ( string $failure_reason ) Failure reason code returned when the payment failed for some valid reasons.
setId ( string $id ) Identifier of the payment resource created.
setIntent ( string $intent ) Payment intent.
setNoteToPayer ( string $note_to_payer ) free-form field for the use of clients to pass in a message to the payer
setPayee ( Payee $payee ) Receiver of funds for this payment.
setPayer ( Payer $payer ) Source of the funds for this payment represented by a PayPal account or a direct credit card.
setPaymentInstruction ( PayPal\Api\PaymentInstruction $payment_instruction ) Instructions for the payer to complete this payment.
setPotentialPayerInfo ( PotentialPayerInfo $potential_payer_info ) Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.
setRedirectUrls ( PayPal\Api\RedirectUrls $redirect_urls ) Set of redirect URLs you provide only for PayPal-based payments.
setState ( string $state ) The state of the payment, authorization, or order transaction. The value is:
  • created. The transaction was successfully created.
  • approved. The buyer approved the transaction.
  • failed. The transaction request failed.
Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"]
setTransactions ( Transaction[] $transactions ) Transactional details including the amount and item details.
setUpdateTime ( string $update_time ) Payment update time as defined in RFC 3339 Section 5.6.
update ( PatchRequest $patchRequest, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : boolean Partially updates a payment, by ID. You can update the amount, shipping address, invoice ID, and custom data. You cannot use patch after execute has been called.

Method Details

addBillingAgreementToken() public method

Append BillingAgreementTokens to the list.
Deprecation: Not publicly available
public addBillingAgreementToken ( string $billingAgreementToken )
$billingAgreementToken string

addFailedTransaction() public method

Append FailedTransactions to the list.
Deprecation: Not publicly available
public addFailedTransaction ( Error $error )
$error Error

addTransaction() public method

Append Transactions to the list.
public addTransaction ( Transaction $transaction )
$transaction Transaction

all() public static method

List payments that were made to the merchant who issues the request. Payments can be in any state.
public static all ( array $params, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : PaymentHistory
$params array
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPalRestCall is the Rest Call Service that is used to make rest calls
return PaymentHistory

create() public method

Creates and processes a payment. In the JSON request body, include a payment object with the intent, payer, and transactions. For PayPal payments, include redirect URLs in the payment object.
public create ( ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : Payment
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPalRestCall is the Rest Call Service that is used to make rest calls
return Payment

execute() public method

Executes, or completes, a PayPal payment that the payer has approved. You can optionally update selective payment information when you execute a payment.
public execute ( PaymentExecution $paymentExecution, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : Payment
$paymentExecution PaymentExecution
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPalRestCall is the Rest Call Service that is used to make rest calls
return Payment

get() public static method

Shows details for a payment, by ID.
public static get ( string $paymentId, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : Payment
$paymentId string
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPalRestCall is the Rest Call Service that is used to make rest calls
return Payment

getBillingAgreementTokens() public method

Collection of PayPal generated billing agreement tokens.
Deprecation: Not publicly available
public getBillingAgreementTokens ( ) : string[]
return string[]

getCart() public method

ID of the cart to execute the payment.
Deprecation: Not publicly available
public getCart ( ) : string
return string

getCreateTime() public method

Payment creation time as defined in RFC 3339 Section 5.6.
public getCreateTime ( ) : string
return string

getCreditFinancingOffered() public method

Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in
Deprecation: Not publicly available
public getCreditFinancingOffered ( ) : PayPal\Api\CreditFinancingOffered
return PayPal\Api\CreditFinancingOffered

getExperienceProfileId() public method

PayPal generated identifier for the merchant's payment experience profile. Refer to this link to create experience profile ID.
public getExperienceProfileId ( ) : string
return string

getFailedTransactions() public method

Applicable for advanced payments like multi seller payment (MSP) to support partial failures
Deprecation: Not publicly available
public getFailedTransactions ( ) : Error[]
return Error[]

getFailureReason() public method

Failure reason code returned when the payment failed for some valid reasons.
public getFailureReason ( ) : string
return string

getId() public method

Identifier of the payment resource created.
public getId ( ) : string
return string

getIntent() public method

Payment intent.
public getIntent ( ) : string
return string

getNoteToPayer() public method

free-form field for the use of clients to pass in a message to the payer
public getNoteToPayer ( ) : string
return string

getPayee() public method

Receiver of funds for this payment.
public getPayee ( ) : Payee
return Payee

getPayer() public method

Source of the funds for this payment represented by a PayPal account or a direct credit card.
public getPayer ( ) : Payer
return Payer

getPaymentInstruction() public method

Instructions for the payer to complete this payment.
Deprecation: Not publicly available
public getPaymentInstruction ( ) : PayPal\Api\PaymentInstruction
return PayPal\Api\PaymentInstruction

getPotentialPayerInfo() public method

Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.
Deprecation: Not publicly available
public getPotentialPayerInfo ( ) : PotentialPayerInfo
return PotentialPayerInfo

getRedirectUrls() public method

Set of redirect URLs you provide only for PayPal-based payments.
public getRedirectUrls ( ) : PayPal\Api\RedirectUrls
return PayPal\Api\RedirectUrls

getState() public method

The state of the payment, authorization, or order transaction. The value is:
  • created. The transaction was successfully created.
  • approved. The buyer approved the transaction.
  • failed. The transaction request failed.
public getState ( ) : string
return string

getTransactions() public method

Transactional details including the amount and item details.
public getTransactions ( ) : Transaction[]
return Transaction[]

getUpdateTime() public method

Payment update time as defined in RFC 3339 Section 5.6.
public getUpdateTime ( ) : string
return string

removeBillingAgreementToken() public method

Remove BillingAgreementTokens from the list.
Deprecation: Not publicly available
public removeBillingAgreementToken ( string $billingAgreementToken )
$billingAgreementToken string

removeFailedTransaction() public method

Remove FailedTransactions from the list.
Deprecation: Not publicly available
public removeFailedTransaction ( Error $error )
$error Error

removeTransaction() public method

Remove Transactions from the list.
public removeTransaction ( Transaction $transaction )
$transaction Transaction

setBillingAgreementTokens() public method

Collection of PayPal generated billing agreement tokens.
Deprecation: Not publicly available
public setBillingAgreementTokens ( string[] $billing_agreement_tokens )
$billing_agreement_tokens string[]

setCart() public method

ID of the cart to execute the payment.
Deprecation: Not publicly available
public setCart ( string $cart )
$cart string

setCreateTime() public method

Payment creation time as defined in RFC 3339 Section 5.6.
public setCreateTime ( string $create_time )
$create_time string

setCreditFinancingOffered() public method

Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in
Deprecation: Not publicly available
public setCreditFinancingOffered ( PayPal\Api\CreditFinancingOffered $credit_financing_offered )
$credit_financing_offered PayPal\Api\CreditFinancingOffered

setExperienceProfileId() public method

PayPal generated identifier for the merchant's payment experience profile. Refer to this link to create experience profile ID.
public setExperienceProfileId ( string $experience_profile_id )
$experience_profile_id string

setFailedTransactions() public method

Applicable for advanced payments like multi seller payment (MSP) to support partial failures
Deprecation: Not publicly available
public setFailedTransactions ( Error[] $failed_transactions )
$failed_transactions Error[]

setFailureReason() public method

Valid Values: ["UNABLE_TO_COMPLETE_TRANSACTION", "INVALID_PAYMENT_METHOD", "PAYER_CANNOT_PAY", "CANNOT_PAY_THIS_PAYEE", "REDIRECT_REQUIRED", "PAYEE_FILTER_RESTRICTIONS"]
public setFailureReason ( string $failure_reason )
$failure_reason string

setId() public method

Identifier of the payment resource created.
public setId ( string $id )
$id string

setIntent() public method

Valid Values: ["sale", "authorize", "order"]
public setIntent ( string $intent )
$intent string

setNoteToPayer() public method

free-form field for the use of clients to pass in a message to the payer
public setNoteToPayer ( string $note_to_payer )
$note_to_payer string

setPayee() public method

Receiver of funds for this payment.
public setPayee ( Payee $payee )
$payee Payee

setPayer() public method

Source of the funds for this payment represented by a PayPal account or a direct credit card.
public setPayer ( Payer $payer )
$payer Payer

setPaymentInstruction() public method

Instructions for the payer to complete this payment.
Deprecation: Not publicly available
public setPaymentInstruction ( PayPal\Api\PaymentInstruction $payment_instruction )
$payment_instruction PayPal\Api\PaymentInstruction

setPotentialPayerInfo() public method

Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic.
Deprecation: Not publicly available
public setPotentialPayerInfo ( PotentialPayerInfo $potential_payer_info )
$potential_payer_info PotentialPayerInfo

setRedirectUrls() public method

Set of redirect URLs you provide only for PayPal-based payments.
public setRedirectUrls ( PayPal\Api\RedirectUrls $redirect_urls )
$redirect_urls PayPal\Api\RedirectUrls

setState() public method

The state of the payment, authorization, or order transaction. The value is:
  • created. The transaction was successfully created.
  • approved. The buyer approved the transaction.
  • failed. The transaction request failed.
Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"]
public setState ( string $state )
$state string

setTransactions() public method

Transactional details including the amount and item details.
public setTransactions ( Transaction[] $transactions )
$transactions Transaction[]

setUpdateTime() public method

Payment update time as defined in RFC 3339 Section 5.6.
public setUpdateTime ( string $update_time )
$update_time string

update() public method

Partially updates a payment, by ID. You can update the amount, shipping address, invoice ID, and custom data. You cannot use patch after execute has been called.
public update ( PatchRequest $patchRequest, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : boolean
$patchRequest PatchRequest
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPalRestCall is the Rest Call Service that is used to make rest calls
return boolean