-
Notifications
You must be signed in to change notification settings - Fork 12
/
check-profile.php
56 lines (46 loc) · 2.3 KB
/
check-profile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
require_once( 'functions.php' );
if( ! isset( $_GET['profile_id'] ) && ! isset( $_GET['transaction_id'] ) )
die( 'Check Profile Requires a profile_id or transaction_id specified in the URL ($_GET)' );
?>
<html>
<head>
<title>PayPal Recurring Payment Profile</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="container">
<?php if( isset( $_GET['profile_id'] ) ) :
$paypal = create_example_subscription();
if( isset( $_GET['action'] ) ) {
if( 'suspend' == $_GET['action'] )
$paypal->manage_subscription_status( $_GET['profile_id'], 'Suspend', 'Suspended subscription via PayPal Digital Goods PHP Example');
elseif( 'cancel' == $_GET['action'] )
$paypal->manage_subscription_status( $_GET['profile_id'], 'Cancel', 'Cancelled subscription via PayPal Digital Goods PHP Example');
elseif( 'reactivate' == $_GET['action'] )
$paypal->manage_subscription_status( $_GET['profile_id'], 'Reactivate', 'Reactivated subscription via PayPal Digital Goods PHP Example');
} ?>
<h2>PayPal Subscription Details</h2>
<pre>
$paypal->get_profile_details( $_GET['profile_id'] ) ) =
<?php $profile_details = $paypal->get_profile_details( $_GET['profile_id'] ); ?>
<?php print_r( $profile_details ); ?>
</pre>
<?php if ( 'Active' == $profile_details['STATUS'] ) : ?>
<p><a href="<?php echo get_script_uri( 'check-profile.php?profile_id=' . $_GET['profile_id'] . '&action=suspend' ) ?>" target="_top">Suspend Subscription »</a></p>
<p><a href="<?php echo get_script_uri( 'check-profile.php?profile_id=' . $_GET['profile_id'] . '&action=cancel' ) ?>" target="_top">Cancel Subscription »</a></p>
<?php elseif ( 'Suspended' == $profile_details['STATUS'] ) : ?>
<p><a href="<?php echo get_script_uri( 'check-profile.php?profile_id=' . $_GET['profile_id'] . '&action=reactivate' ) ?>" target="_top">Reactivate Subscription »</a></p>
<?php endif; ?>
<?php else : ?>
<?php $paypal = create_example_purchase(); ?>
<h2>PayPal Transaction Details</h2>
<pre>
$paypal->get_transaction_details( $_GET['transaction_id'] ) ); =
<?php print_r( $paypal->get_transaction_details( $_GET['transaction_id'] ) ); ?>
</pre>
<?php endif; ?>
<p><a href="<?php echo get_script_uri(); ?>" target="_top">Return to Examples Overview »</a></p>
<div>
</body>
</html>