PHP Class PayPal\Api\Payment

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

Méthodes publiques

Méthode 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 méthode

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

addFailedTransaction() public méthode

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

addTransaction() public méthode

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

all() public static méthode

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
Résultat PaymentHistory

create() public méthode

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
Résultat Payment

execute() public méthode

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
Résultat Payment

get() public static méthode

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
Résultat Payment

getBillingAgreementTokens() public méthode

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

getCart() public méthode

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

getCreateTime() public méthode

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

getCreditFinancingOffered() public méthode

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

getExperienceProfileId() public méthode

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

getFailedTransactions() public méthode

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

getFailureReason() public méthode

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

getId() public méthode

Identifier of the payment resource created.
public getId ( ) : string
Résultat string

getIntent() public méthode

Payment intent.
public getIntent ( ) : string
Résultat string

getNoteToPayer() public méthode

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

getPayee() public méthode

Receiver of funds for this payment.
public getPayee ( ) : Payee
Résultat Payee

getPayer() public méthode

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

getPaymentInstruction() public méthode

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

getPotentialPayerInfo() public méthode

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
Résultat PotentialPayerInfo

getRedirectUrls() public méthode

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

getState() public méthode

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
Résultat string

getTransactions() public méthode

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

getUpdateTime() public méthode

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

removeBillingAgreementToken() public méthode

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

removeFailedTransaction() public méthode

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

removeTransaction() public méthode

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

setBillingAgreementTokens() public méthode

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

setCart() public méthode

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

setCreateTime() public méthode

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

setCreditFinancingOffered() public méthode

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 méthode

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 méthode

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 méthode

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 méthode

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

setIntent() public méthode

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

setNoteToPayer() public méthode

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 méthode

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

setPayer() public méthode

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 méthode

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 méthode

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 méthode

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 méthode

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 méthode

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

setUpdateTime() public méthode

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

update() public méthode

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
Résultat boolean