Skip to content

Conversation

@vikvenkataraman
Copy link

No description provided.

class UpdatePaymentLinkParameters(BaseModel):
"""Parameters for updating a payment link (full replacement)"""
payment_link_id: str = Field(..., pattern=PAYMENT_LINK_ID_REGEX, description="The PayPal Payment Link ID to update. Format: PLB-XXXXXXXXXXXX (PLB- prefix followed by 12-16 alphanumeric characters). Example: 'PLB-1A2B3C4D5E6F'")
integration_mode: str = Field(default="LINK", description="The integration mode for the payment link. Default and recommended: 'LINK'.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove Note: 'DONATION' type has limited support and may cause validation errors.

"""
Validate payment link type
"""
supported_types = ['BUY_NOW', 'DONATION']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove: 'DONATION'

"field": "type"
}

if payment_type == 'DONATION':

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove


export const updatePaymentLinkParameters = (context: Context) => z.object({
payment_link_id: z.string().regex(PAYMENT_LINK_ID_REGEX, "Invalid PayPal Payment Link ID").describe('The PayPal Payment Link ID to update. Format: PLB-XXXXXXXXXXXX (PLB- prefix followed by 12-16 alphanumeric characters). Example: "PLB-1A2B3C4D5E6F"'),
type: z.string().describe('The type of payment link. Use "BUY_NOW" for standard e-commerce purchases (fully supported). Note: "DONATION" type has limited support and may cause validation errors.'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove Note: 'DONATION' type has limited support and may cause validation errors.


export const createPaymentLinkParameters = (context: Context) => z.object({
integration_mode: z.string().optional().default('LINK').describe('The integration mode for the payment link. Default and recommended: "LINK". This determines how the payment link is presented.'),
type: z.string().describe('The type of payment link. Use "BUY_NOW" for standard e-commerce purchases (fully supported). Note: "DONATION" type has limited support and may cause validation errors.'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove Note: 'DONATION' type has limited support and may cause validation errors.

* Validate payment link type
*/
export function validatePaymentLinkType(type: string): ValidationResult {
const supportedTypes = ['BUY_NOW', 'DONATION'];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove DONATION

};
}

if (type === 'DONATION') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove DONATION

This function permanently deletes a payment link. Once deleted, the shareable link URL will no longer work and the operation cannot be undone. Use with caution.
Note: PayPal API may return a 500 error instead of 404 for non-existent payment link IDs. This is expected API behavior.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500 ?

Delete a payment link created through the PayPal Pay Links & Buttons API.

This operation deactivates the payment link so it can no longer be used by customers.
Once deleted, the shareable link URL will stop working.

### Important notes
- Deletion removes the payment resource from active use. A deleted link cannot be used for future payments.
- If an invalid or non-existent payment link ID is provided, the PayPal API may return a 404 Not Found error.
- This operation does not affect completed transactions tied to the link.

### Required fields
- `id`: Unique identifier of the payment link you want to delete.

### Example usage
To delete a payment link:
delete_payment_link(
id="PR-1234567890"
)

Copy link

@perumalcsbe perumalcsbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants