Skip to content

Commit 7334a2b

Browse files
committed
Documentation - PDF confirmation
1 parent e479fea commit 7334a2b

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

doc/generate-payment-confirmation.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
1-
# Generating a confirmation PDF for paid payment
1+
# Generating a Payment Confirmation PDF
22

3-
If a merchant needs confirmation for someone that they received payment through our services.
4-
They can generate a confirmation PDF document for payment in ThePay administration.
3+
Merchants can generate a payment confirmation PDF as proof that a specific payment was successfully received through ThePay.
54

6-
The generating confirmation can be also integrated into merchant application as describe example below.
5+
This document can be generated manually in ThePay Administration, or automatically via API integration in your application.
6+
7+
## API integration example
8+
9+
To integrate payment confirmation generation into your application, you can use the following example:
710

811
```php
912

1013
/** @var \ThePay\ApiClient\TheClient $thePayClient */
1114

12-
$payment = $thePayClient->getPayment('exampleUID');
13-
// make detection if payment was really paid
14-
// and inform user that for not paid payment is confirmation unavailable,
15-
// because call method generatePaymentConfirmationPdf for unpaid payments will fail
16-
if($payment->wasPaid()) {
15+
$payment = $thePayClient->getPayment('uid123');
16+
17+
// Check if the payment has been successfully completed.
18+
// Confirmation can only be generated for paid payments.
19+
if ($payment->wasPaid()) {
1720

18-
// we recommend asking user for language of receiver who confirmation wants, so he can understand it,
19-
// if we not support given language, we return confirmation in english
21+
// Optionally, ask the user to select the preferred language for the confirmation document.
22+
// If the specified language is not supported, the PDF will default to English.
2023
$confirmationLanguageCode = 'cs';
2124

22-
$confirmationPdfContent = $thePayClient->generatePaymentConfirmationPdf('exampleUID', $confirmationLanguageCode);
25+
// Generate the confirmation PDF
26+
$confirmationPdfContent = $thePayClient->generatePaymentConfirmationPdf('uid123', $confirmationLanguageCode);
2327

2428
header('Content-type:application/pdf');
2529

0 commit comments

Comments
 (0)